在硒javascript上使用用户名和密码身份验证添加代理

发布于 2025-02-13 15:58:04 字数 510 浏览 1 评论 0原文

当我尝试将代理添加到程序中时,它不适用于用户名和密码身份验证,我只是会出现错误,说无法联系网站,但是当我删除用户名和密码代理登录时,弹出了弹出,当我输入它时,一切都可以使用。

const { Builder } = require('selenium-webdriver')

const chrome = require('selenium-webdriver/chrome')

const PROXY = "username:password@ip:port"

const option = new chrome.Options().addArguments(\--proxy-server=http://${PROXY}`)`

const driver = new Builder().forBrowser('chrome').setChromeOptions(option).build()

driver.get('http://httpbin.org/ip')
.then(() => console.log('DONE'))```

when i try to add proxy to my program it doesnt work with username and password authentication I just get error saying website cant be reached but when I remove username and password proxy login pops up and when I enter it everything works okey.

const { Builder } = require('selenium-webdriver')

const chrome = require('selenium-webdriver/chrome')

const PROXY = "username:password@ip:port"

const option = new chrome.Options().addArguments(\--proxy-server=http://${PROXY}`)`

const driver = new Builder().forBrowser('chrome').setChromeOptions(option).build()

driver.get('http://httpbin.org/ip')
.then(() => console.log('DONE'))```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文