Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Selenium自动代理用户名/密码不起作用_Python_Python 2.7_Python 3.x_Selenium Webdriver - Fatal编程技术网

Python Selenium自动代理用户名/密码不起作用

Python Selenium自动代理用户名/密码不起作用,python,python-2.7,python-3.x,selenium-webdriver,Python,Python 2.7,Python 3.x,Selenium Webdriver,当我这样做时,这个页面不会加载(因为互联网断开了),但当我从ip变量中删除username:password时,一个弹出窗口会询问用户名密码 我不知道如何自动化这件事我的意思是通过程序传递用户名/传递? 我甚至不知道如何在弹出窗口中传递用户名/密码(当我不知道标签名时,如何使用发送密钥) 我做了alert=driver.切换到.alert现在怎么办 无论如何,如果有这样的事情,那就太好了 ip = "username:password@123.456.78.9" #ip = "http://us

当我这样做时,这个页面不会加载(因为互联网断开了),但当我从
ip
变量中删除username:password时,一个弹出窗口会询问用户名密码

我不知道如何自动化这件事我的意思是通过程序传递用户名/传递? 我甚至不知道如何在弹出窗口中传递用户名/密码(当我不知道标签名时,如何使用
发送密钥
) 我做了
alert=driver.切换到.alert
现在怎么办

无论如何,如果有这样的事情,那就太好了

ip = "username:password@123.456.78.9"
#ip = "http://username:password@123.456.78.9"  # tried this as well but same result

profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", ip)
profile.set_preference("network.proxy.http_port", 80)
profile.set_preference("general.useragent.override","some_user_agent")
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.maximize_window()
driver.get('http://www.whatismyip.com/')
我不知道

我已经访问了5-6个SOF线程,并尝试了它们的解决方案(所有这些线程都建议使用相同的解决方案,但都是在2012/13年)。 在这里 有人(2012年)发布了一个Java解决方案 我们是否有类似的东西
fp.setPreference(“browser.safebrowsing.malware.enabled”,false)
用python

profile.set_preference("network.proxy.user_name", 'username')
profile.set_preference("network.proxy.password", 'password')