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

I have recently installed PhantomJS and encountered this error on my first run:

from selenium import webdriver

from selenium.webdriver.common.keys import Keys

driver = webdriver.PhantomJS()


driver.find_element_by_id('some_element').send_keys('something' + Keys.RETURN)

This code works with Firefox webdriver but does not work with PhantomJS. I get the following error:

Traceback (most recent call last):

  File "<PATHTOFILE>", line 20, in <module>

    driver.find_element_by_id('lst-ib').send_keys('something' + Keys.RETURN)

  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/", line 266, in find_element_by_id

    return self.find_element(by=By.ID, value=id_)

  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/", line 744, in find_element

    {'using': by, 'value': value})['value']

  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/", line 233, in execute


  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/", line 165, in check_response

    raise exception_class(value)

selenium.common.exceptions.WebDriverException: Message: Error - Unable to load Atom 'find_element' from file ':/ghostdriver/./third_party/webdriver-atoms/find_element.js'

1 Answer

0 votes
by (62.9k points)

These are the precise steps that worked for me:

​​​​​​​​​​​​​​Purge old phantomjs

apt purge phantomjs

Wget the latest phantomjs (as per 


 Untar it

tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2

 Moved the phantomjs executable to /usr/bin/ (may need sudo)

cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/​​​​​​​

Browse Categories