0

The following code is supposed to print the contents of this page.

from selenium import webdriver
driver = webdriver.PhantomJS()
link = u'https://scholar.google.co.il/scholar?q=The+Trellis+Security+Infrastructure:+{A}+Layered+Approach+to+Overlay+Metacomputers'
driver.get(link)
print driver.page_source

However, all it prints is:

<html><head></head><body></body></html>

If I use webdriver.Firefox() instead of webdriver.PhantomJS(), it works. I know that PhantomJS is properly installed, since the above code used to work just fine. What could this mean?

AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68

1 Answers1

1

Which version of Selenium/PhantomJs are you using? I tried with:

  • Selenium 3.6.0
  • PhantomJs 2.1.1

this:

from selenium import webdriver

driver = webdriver.PhantomJS(executable_path=r'PathTo/phantomjs-2.1.1-macosx/bin/phantomjs')
link = 'https://scholar.google.co.il/scholar?q=The+Trellis+Security+Infrastructure:+{A}+Layered+Approach+to+Overlay+Metacomputers'
driver.get(link)
print (driver.page_source)

and it works.

Davide Patti
  • 3,391
  • 2
  • 18
  • 20
  • 1
    Found the solution! https://stackoverflow.com/a/34257642/2725810 Accepting this answer as it led me to solve the problem. – AlwaysLearning Oct 22 '17 at 19:11