且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在python webdriver中为phantomjs/ghostdriver设置代理?

更新时间:2023-09-18 17:20:22

下面是如何在Python中设置PhantomJs代理的示例.您可以更改代理类型:socks5/http.

Below is the example of how to set proxy for PhantomJs in Python. You may change proxy type: socks5/http.

service_args = [
    '--proxy=127.0.0.1:9999',
    '--proxy-type=socks5',
    ]
browser = webdriver.PhantomJS('../path_to/phantomjs',service_args=service_args)