Python Selenium Phantomjs,代理身份验证不起作用
我在StackOverflow上找到了这个代码。试过了,但没用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
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正在暂停开发:也没有找到任何解决方案