Selenium与自定义代理

时间:2016-12-15 13:16:53

标签: selenium selenium-webdriver protractor

我想使用自定义代理/端口启动 chrome 。我这样开始硒:

java -Dwebdriver.chrome.driver="node_modules/webdriver-manager/selenium/chromedriver" -jar node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar -port 5555 > log.txt &

我正在使用theese参数设置代理/端口:

 -Dhttp.proxyHost=http://xx.xxx.xx.xxx -Dhttp.proxyPort=8080

但它似乎没有用。

我也尝试过:

"capabilities":
{
    "browserName": 'chrome',
    //"chromeOptions": {"binary": "/opt/bamboo1/bamboo-agent-home/xml-data/build-dir/PP-AT-TES/opt/google/chrome/chrome"}
    //"chromeOptions": {"binary": "/opt/google/chrome/chrome"}

    'proxy':{
        'proxyType': 'MANUAL',
        'httpProxy': 'http://xx.xxx.xx.xxx:8080',
        'sslProxy': 'http://xx.xxx.xx.xxx:8080'
    }
}

1 个答案:

答案 0 :(得分:0)

这确实有效。问题发生在我的服务器上。

"capabilities":
{
    "browserName": 'chrome',
    //"chromeOptions": {"binary": "/opt/bamboo1/bamboo-agent-home/xml-data/build-dir/PP-AT-TES/opt/google/chrome/chrome"}
    //"chromeOptions": {"binary": "/opt/google/chrome/chrome"}

    'proxy':{
        'proxyType': 'MANUAL',
        'httpProxy': 'http://10.165.42.170:80',
        'sslProxy': 'http://10.165.42.170:80',
        'noProxy': 'url.sk,url2.sk'
    }
}