1

the first thing I wanted to do is, installing Selenium in Windows.

So installed Selenium with pip install selenium and tried to import it with

from selenium import webdriver

but I got the error

Traceback (most recent call last): File "C:\Users\admin\AppData\Local\Programs\Python\Python36-32\selentest.py", line 1, in from selenium import webdriver ModuleNotFoundError: No module named 'selenium'

So I made me an VM in VirtualBox (Kali Linux, Debian 64) and tried installing Selenium there.

It worked just fine, but then I got problems with the webdriver.

I chose the Firefox Geckodriver (geckodriver-v0.18.0-linux32.tar.gz at https://github.com/mozilla/geckodriver/releases)

I pat it into an folder named "Selenium" (/root/Desktop/Selenium) and placed the following script into it:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox("/root/Desktop/Selenium/")
driver.get("http://www.python.org")

And got the error:

root@kali:~/Desktop/Selenium# python main.py
Traceback (most recent call last):
  File "main.py", line 4, in <module>
    driver = webdriver.Firefox("/root/Desktop/Selenium/")
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

Here is also an screenshot of the properties of the webdriver: https://i.sstatic.net/Sh4cY.jpg

5
  • 1
    it looks like you are mixing python versions, on windows it looks like you are using 3.6, and on linux you are using 2.7, and it looks like you have tried to use the windows webdriver on linux (which won't work) Commented Jul 31, 2017 at 11:50
  • it's possible you have several versions of python installed on windows, and you've installed selenium on a different version to the one you're trying to use. Commented Jul 31, 2017 at 11:51
  • Its all coming together now :DDD Commented Jul 31, 2017 at 12:08
  • I downloaded the latest python version and get the same error as in windows, no module named selenium :D How to fix that :) @JamesKent Commented Jul 31, 2017 at 12:08
  • see my answer, hopefully that helps. Commented Jul 31, 2017 at 13:08

1 Answer 1

1

ok so to get this to work you need several things:

  1. a version of python you plan to use (doesn't matter which as long as you know the version
  2. an instalation of the selenium python module
  3. a suitable webdriver binary

so assuming you already have item 1, we need to get item 2.
on windows:

cd c:\python36\scripts
pip install selenium

where 36 means python 3.6, so substitute this for which version you are using.

on linux for python2.x:

pip install selenium

on linux for python3.x:

pip3 install selenium

and lastly to get the 3rd item we need to download a webdriver that matches the os.
so from here: https://github.com/mozilla/geckodriver/releases
on windows we would need either the win32 release (32 bit windows) or win64 release (64 bit windows)

and on linux we would need the linux32 release (32 bit linux) or linux64 release (64 bit linux)

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

1 Comment

hm, I cant find the path python36 but I have python 3.6 installed (python3 -v says 3.6)

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.