Python: Selenium with PhantomJS empty page source

后端 未结 4 1748
深忆病人
深忆病人 2020-11-28 14:31

I\'m having trouble with Selenium and PhantomJS on Windows7 when I want to get the source of the page of an URL. browser.page_source returns only

相关标签:
4条回答
  • 2020-11-28 14:47

    Using service_args=['--ignore-ssl-errors=true'] did the trick !

    browser = webdriver.PhantomJS('phantomjs-1.9.7-windows\phantomjs.exe', service_args=['--ignore-ssl-errors=true'])
    
    0 讨论(0)
  • 2020-11-28 14:53

    increasing the screen size as below worked for me:

    driver = webdriver.PhantomJS(path2phantom, service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any']) 
    driver.set_window_size(2000, 1500)

    0 讨论(0)
  • 2020-11-28 14:57

    by default phantomjs use SSLv3, but many sites after bug in ssl migrate to tls. That's why you has blank page. use service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any']

    browser = webdriver.PhantomJS('phantomjs-1.9.7-windows\phantomjs.exe', service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
    
    0 讨论(0)
  • 2020-11-28 15:10
    driverPhantom = webdriver.PhantomJS(driverLocation, service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])      # initaling web driver for PhantomJs
    

    Worked for me.

    0 讨论(0)
提交回复
热议问题