I been referring to this link: https://help.pythonanywhere.com/pages/selenium/
This is a brand new account so I have run the following commands:
pip3.6 install --user "selenium<3" pip3.6 install --user pyvirtualdisplay
They both have installed, and the only change I have made to the code on the website above is add () to the print command. My code is below
from pyvirtualdisplay import Display from selenium import webdriver with Display(): # we can now start Firefox and it will run inside the virtual display browser = webdriver.Firefox() # put the rest of our selenium code in a try/finally # to make sure we always clean up at the end try: browser.get('http://www.google.com') print (browser.title) #this should print "Google" finally: browser.quit()
The error I get is:
Traceback (most recent call last): File "/home/roboman/Selenium Test/selenium.py", line 2, in <module> from selenium import webdriver File "/home/roboman/Selenium Test/selenium.py", line 2, in <module> from selenium import webdriver ImportError: cannot import name 'webdriver'
Would anyone be able to explain this to a newbie? Am I using the wrong version of python (3.6)? Advice would be appreciated. Thanks!