用于连接到java中的webdrivers的付费代理

时间:2015-06-11 09:36:35

标签: java selenium-webdriver proxy

我想通过代理网络连接到webdrivers。即使使用付费代理也是可以接受的,但如何将其集成到Web驱动程序中。除了firefox,我用tor for firefox。

1 个答案:

答案 0 :(得分:0)

对于Chrome -

这是在Python中,您可以将其移植到Java

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % proxy)
driver = webdriver.Chrome("C:\\chromedriver.exe", chrome_options=chrome_options)

对于PhantomJS -

service_args = ['--proxy=%s' % PROXY, '--proxy-type=http']
phantomBinary = "C:\\phantomjs.exe"
driver = webdriver.PhantomJS(executable_path=phantomBinary, service_args=service_args)
相关问题