简体   繁体   English

selenium chrome webdriver 带 toripchanger

[英]selenium chrome webdriver with toripchanger

I am trying to open google search results whit selenium.我正在尝试使用 selenium 打开谷歌搜索结果。 I use toripchanger to change the ip iteratively.我使用 toripchanger 迭代地更改 ip。

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.但驱动无法打开 url。 I dont get response from google.我没有得到谷歌的回应。

After check proxy works, try this.检查代理工作后,试试这个。 Remove "https:// "删除“https://”

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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