# import pandas as pd
# import numpy as np
# file = pd.read_csv('demo.csv', usecols=[2, 4])
# for i in file.values:
# print(','.join(i.tolist()))
from selenium import webdriver
import time
from scrapy.selector import Selector
from selenium.webdriver.common.action_chains import ActionChains
browser = webdriver.Chrome()
browser.get("https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/utils/geocoder/")
browser.maximize_window()
time.sleep(30)
for i in ['9150 COUNTY ROAD 45,Alnwick Twp','86 ROLLING BANKS ROAD #10B,Alnwick Twp','145 NOONAN ROAD,Alnwick Twp','24 PARKER DRIVE,Alnwick Twp','6108 CURTIS POINT ROAD #33,Alnwick Twp','1026 MERRILL ROAD #2,Alnwick Twp','11105 COUNTY RD 29 ROAD,Alnwick Twp','759 5TH LINE ROAD,Alnwick Twp','6274 SHEARER POINT ROAD,Alnwick Twp','111 HOFER ROAD,Alnwick Twp','162 GULLY ROAD,Alnwick Twp','2940 SHELTER VALLEY ROAD,Alnwick Twp','879 MCDONALD ROAD,Alnwick Twp','185 WOODLAND ROAD,Alnwick Twp','161 MCDONALD ROAD,Alnwick Twp','31 CLARK ROAD,Alnwick Twp','11059 COUNTY RD 2 ROAD,Alnwick Twp','1495 4TH LINE,Asphodel-Norwood Twp','557 COUNTY ROAD 22 ROAD,Baltimore','5057 COUNTY 45 ROAD,Baltimore','5146 COUNTY ROAD 45,Baltimore','4706 HARWOOD ROAD N,Baltimore','9327 CHERRY LANE,Baltimore','18 MAPLE CRESCENT,Baltimore','3711 POLLARD ROAD E,Baltimore','4 ELM AVENUE,Baltimore','3281 HARWOOD ROAD,Baltimore','30 ORIOLE CRESCENT,Baltimore','9678 TURK ROAD,Baltimore','331 EARL ROAD,Baltimore','6299 COUNTY RD. 45 ROAD,Baltimore','1 CARDINAL COURT,Baltimore','633 STEWART ROAD,Baltimore','32 NELSON STREET,Batawa','14 HAIG STREET,Batawa','30 SIDNEY CRESCENT,Batawa','52 NELSON STREET,Batawa','75 FRASER DRIVE,Batawa','42 ST. PAUL STREET,Belleville','364 STOKES STREET,Belleville','72 DUNDAS STREET W,Belleville','44 GEDDES STREET,Belleville','25 ASHE CRESCENT,Belleville','2 ELM STREET,Belleville','20 BETTES STREET,Belleville','90 GORDON STREET,Belleville','286 COLEMAN STREET #1/2,Belleville','75 COLLEGE STREET E,Belleville','58 CANNIFTON ROAD,Belleville','33 PEPPER AVENUE,Belleville','59-61 HILLCREST AVENUE,Belleville','312 COLEMAN STREET,Belleville','92 CEDAR STREET,Belleville','26 LIME STREET,Belleville','66 EMILY STREET,Belleville','31 TICE CRESCENT,Belleville','93 GEDDES STREET,Belleville','70 SAFE BOULEVARD,Belleville','221 NORTH PARK STREET #118A,Belleville','47 HILLSIDE STREET,Belleville','31 HENRY STREET,Belleville','128 BRIDGE STREET W,Belleville','74 GORDON STREET,Belleville','16 GROVE STREET,Belleville','15 RAILWAY TERRACE,Belleville','103 CEDAR STREET STREET,Belleville','59 FRANK STREET,Belleville','137 CATHARINE STREET,Belleville','376 DUFFERIN AVENUE,Belleville','436 BLEECKER AVENUE,Belleville','312 COLEMAN STREET,Belleville','6 PONTON STREET,Belleville','210 STATION STREET,Belleville','67 LEWIS STREET,Belleville','77 FRANK STREET,Belleville','3776 HIGHWAY 37,Belleville','71 BYRON STREET,Belleville','97 GREAT SAINT JAMES STREET,Belleville','44 MURNEY STREET,Belleville','26 FORIN STREET,Belleville','100 CHATHAM STREET,Belleville','11 BROWN STREET,Belleville','216 COLLEGE STREET W,Belleville','7220 HIGHWAY 62,Belleville','11 RITCHIE AVENUE,Belleville','72 MCFARLAND DRIVE,Belleville','25 RIDLEY STREET E,Belleville','44 ORCHARD DRIVE,Belleville','29 GRIER STREET,Belleville','2034 OLD HIGHWAY 2 #B,Belleville','344 FRONT STREET #803,Belleville','95 VICTORIA AVENUE,Belleville','48 SINCLAIR STREET,Belleville','22 BRASSEY STREET,Belleville','22 BYRON STREET,Belleville','53 RITCHIE AVENUE,Belleville','59 LANE CRESCENT,Belleville','178 COLLEGE STREET E,Belleville']:
input_str = browser.find_element_by_id("query-input")
input_str.clear()
input_str.send_keys(i+' ON, Canada')
time.sleep(2)
button = browser.find_element_by_id('geocode-button')
button.click()
time.sleep(2)
latlong = ''.join(Selector(text=browser.page_source).xpath("//p[@class='result-location']/text()").getall()).split('(')[0].strip()
print(latlong+' -- '+i)
time.sleep(2)
# ActionChains(browser).move_by_offset(525, 162).click().perform()
button = browser.find_element_by_id('hide-results-link')
button.click()
browser.close()
pandasselenium
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 1 笔记在日常生活的作用是记录生活,而在《如何有效阅读一本书》这本书中,它有独特的作用。 笔记读书法的第一步,就是...