在documentation中,我读到了在构建驱动程序时使用代理集:
var driver = new webdriver.Builder()
.withCapabilities(webdriver.Capabilities.chrome())
.setProxy(proxy.manual({http: 'host:1234'}))
.build();
当我将此代码用于代理' 103.87.16.2:80' - .setProxy(proxy.manual({http: 'host:1234'}))
,我仍有我的家庭IP。
有什么问题?
答案 0 :(得分:0)
const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
let proxyAddress = '212.56.139.253:80'
// Setting the proxy-server option is needed to info chrome to use proxy
let option = new chrome.Options().addArguments(`--proxy-server=http://${proxyAddress}`)
const driver = new Builder()
.forBrowser('chrome')
.setChromeOptions(option)
.build()
driver.get('http://whatismyip.host/')
.then(() => console.log('DONE'))