标签:pixel path url use pytho nexus 5 useragent highlight from
from selenium import webdriver from selenium.webdriver.chrome.options import Options url_seed = ‘http://m.sogou.com/web/searchList.jsp?pid=sogou-mobb-123asd-0007&keyword=百度地图‘ mobile_emulation = { "deviceMetrics": {"width": 360, "height": 640, "pixelRatio": 3.0}, "userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"} chrome_options = Options() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) browser = webdriver.Chrome(chrome_options=chrome_options) browser.get(url_seed) js = ‘document.getElementsByClassName("input-default js_input")[0].value="深圳市南山区海岸城"‘ browser.execute_script(js) xp = ‘//*[@id="sogou_vr_21384401_1_wrap"]/div/div[1]/a‘ browser.find_element_by_xpath(xp).click()
spider from mobile to mobile to mobile
标签:pixel path url use pytho nexus 5 useragent highlight from
原文地址:http://www.cnblogs.com/yuanjiangw/p/7396160.html