Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.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 Phantomjs,代理身份验证不起作用_Python_Python 3.x_Selenium_Selenium Webdriver_Phantomjs - Fatal编程技术网

Python Selenium Phantomjs,代理身份验证不起作用

Python Selenium Phantomjs,代理身份验证不起作用,python,python-3.x,selenium,selenium-webdriver,phantomjs,Python,Python 3.x,Selenium,Selenium Webdriver,Phantomjs,我在StackOverflow上找到了这个代码。试过了,但没用 from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import base64 service_args = [ '--proxy=zproxy.lum-superproxy.io:22225', '--proxy-type=http', ] aut

我在StackOverflow上找到了这个代码。试过了,但没用

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import base64
service_args = [
    '--proxy=zproxy.lum-superproxy.io:22225',
    '--proxy-type=http',
]

authentication_token = "Basic " + str(base64.b64encode(b'username:password'))

capa = DesiredCapabilities.PHANTOMJS
capa['phantomjs.page.customHeaders.Proxy-Authorization'] = authentication_token
driver = webdriver.PhantomJS(desired_capabilities=capa, service_args=service_args)

driver.get('https://www.ipify.org/')
driver.page_source

driver.close()
注意:用户名和密码只是伪字符串

输出为:

'<html><head></head><body></body></html>'
“”
有人能帮我解决这个问题吗


提前谢谢

尝试使用不同的webdriver,如geckowebdriver或Chromedriver,因为phantomjs正在暂停开发:

也没有找到任何解决方案