0

I am at the stage of installing Selenium on Ubuntu using Python3 (I want to automate Chrome).

I have installed pip3, chromedriver and when I run the following code in Pycharm:

import os  
from selenium import webdriver  
chromedriver = '/home/anastasia/development/python/projects/selenium/chromedriver'  
os.environ['webdriver.chrome.driver'] = chromedriver  
driver = webdriver.Chrome(chromedriver)  
driver.get("http://stackoverflow.com")  

Get an error "ImportError: cannot import name 'webdriver'" then I press alt+Enter on webdriver - select Install package and get an error:

"Install Packages Failed. pip install webdriver Non-zero exit code (1)"

I assume the problem is with the version of pip used. How should I correctly set the version pip3 to be used?

5
  • What is the result of "pip --version"? Commented Apr 10, 2017 at 19:48
  • try install using pip3 install webdriver Commented Apr 10, 2017 at 22:16
  • @JeroenHeier :~$ pip --version pip 9.0.1 from /home/anastasia/.local/lib/python2.7/site-packages (python 2.7) :~$ pip3 --version pip 9.0.1 from /home/anastasia/.local/lib/python3.5/site-packages (python 3.5) Commented Apr 11, 2017 at 20:37
  • @zhiqianghuang Tried "pip3 install webdriver" it says: Collecting webdriver Could not find a version that satisfies the requirement webdriver (from versions: ) No matching distribution found for webdriver Commented Apr 11, 2017 at 20:38
  • pip3 install selenium Requirement already satisfied: selenium in /usr/local/lib/python3.5/dist-packages Commented Apr 11, 2017 at 20:40

1 Answer 1

1

The problem was in google-chrome version. It appeared I got not the lattest. And it was incompatible with the latest chromedriver. After I upgraded chrome all worked successfully!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.