Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.7k points)

I'm having trouble with Selenium and PhantomJS on Windows7 when I want to get the source of the page of a URL. browser.page_source returns only <html><head></head></html>. I've put sleep before browser.page_source but it didn't help.

This is my code:

from selenium import webdriver

browser = webdriver.PhantomJS('phantomjs-1.9.7-windows\phantomjs.exe')

url = 'myurl'


print browser.page_source

On Linux with the same version of PhantomJS, it works perfectly. Also, it works on Windows Server 2003.

1 Answer

0 votes
by (62.9k points)

Using service_args=['--ignore-ssl-errors=true'] worked for me, use the code snippet below:

browser = webdriver.PhantomJS('phantomjs-1.9.7-windows\phantomjs.exe', service_args=['--ignore-ssl-errors=true'])

Browse Categories