简体   繁体   中英

selenium chrome webdriver with toripchanger

I am trying to open google search results whit selenium. I use toripchanger to change the ip iteratively.

tor_ip_changer = TorIpChanger(reuse_threshold=0,
                              local_http_proxy='127.0.0.1:8118')
ip = tor_ip_changer.get_new_ip()
current_ip = tor_ip_changer.get_current_ip()

PROXY = "%s:8118" % ip
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=https://%s' % PROXY)
browser = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver",
                           options=chrome_options)
browser_1 = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver",
                             options=chrome_options)

search_query = "microsoft site:instagram.com"
browser.get("https://www.google.com/search?q=" + search_query + "&start=" + str(10 * i))

But the driver cannot open the url. I dont get response from google.

After check proxy works, try this. Remove "https:// "

chrome_options.add_argument('--proxy-server=%s' % PROXY)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM