简体   繁体   English

付费代理,用于连接Java中的Webdriver

[英]Paid Proxy for connecting to webdrivers in java

i want to connect to webdrivers through proxy networks. 我想通过代理网络连接到webdriver。 Even paid proxies to be use is acceptable, but how to integrate it in web driver. 甚至可以使用付费代理,但是如何将其集成到Web驱动程序中。 except firefox, i used tor for firefox. 除了firefox,我用过torfox。

For Chrome - 对于Chrome-

This is in Python, you can port it to Java 这是在Python中,您可以将其移植到Java

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

For PhantomJS - 对于PhantomJS-

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

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

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