我正在尝试使用 Python 在 Selenium 中使用用户名和密码对代理进行身份验证,但当前代码不起作用。我尝试了很多解决方案,但没有一个有效。
代理示例,
IP = xxx.xx.xx.xx
PORT = xxxxx
USERNAME = USERNAME
PASSWORD = PASSWORD
我使用了以下代码,
driver.execute_script("""
Services.prefs.setIntPref('network.proxy.type', 1);
Services.prefs.setCharPref("network.proxy.http", arguments[0]);
Services.prefs.setIntPref("network.proxy.http_port", arguments[1]);
Services.prefs.setCharPref("network.proxy.ssl", arguments[0]);
Services.prefs.setIntPref("network.proxy.ssl_port", arguments[1]);
Services.prefs.setCharPref('network.proxy.socks', arguments[4]);
Services.prefs.setIntPref('network.proxy.socks_port', arguments[5]);
Services.prefs.setCharPref('network.proxy.socks_username', arguments[6]);
Services.prefs.setCharPref('network.proxy.socks_password', arguments[7]);
""", http_addr, http_port, ssl_addr, ssl_port, socks_addr, socks_port, socks_username, socks_password)
我也尝试过其他一些代码片段。我也尝试将值放入警报框中。
繁华开满天机
相关分类