带有PhantomJS的Python和Selenium提供了空页面

带有PhantomJS的Python和Selenium提供了空页面,python,selenium,proxy,phantomjs,socks,Python,Selenium,Proxy,Phantomjs,Socks,我将Python与Selenium和PhantomJS结合使用 当我尝试使用Socks4或Socks5代理访问网页时,会得到一个空页面 phantomjs_path = '/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs' service_args = [ '--proxy=209.141.36.93:1080', '--proxy-type=socks4', '--ignore-ssl-err

我将Python与Selenium和PhantomJS结合使用

当我尝试使用Socks4或Socks5代理访问网页时,会得到一个空页面

phantomjs_path = '/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs'
service_args = [
    '--proxy=209.141.36.93:1080',
    '--proxy-type=socks4',
    '--ignore-ssl-errors=true',
    '--ssl-protocol=any',
]
dcap = dict(DesiredCapabilities.PHANTOMJS)
dcap["phantomjs.page.settings.userAgent"] = (
    "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K) AppleWebKit/537.36 "
    "(KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36"
)

driver = webdriver.PhantomJS(desired_capabilities=dcap,
                             service_args=service_args,
                             executable_path=phantomjs_path)

driver.get("http://2ip.ru")
time.sleep(10)
print driver.current_url
print driver.page_source
结果:

about:blank
<html><head></head><body></body></html>
关于:空白

请帮助。

因此我认为这与https站点的SSL加密有关,因此添加显式等待不会有帮助

在上一篇文章中,我注意到以下方法可行,将PhantomJS驱动程序称为:

driver = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=true', '--ssl-protocol=TLSv1'])

因此,我认为这与https站点的SSL加密有关,因此添加显式等待不会有帮助

在上一篇文章中,我注意到以下方法可行,将PhantomJS驱动程序称为:

driver = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=true', '--ssl-protocol=TLSv1'])