0

I want to learn to use Selenium but I don't really know what I'm doing wrong. When I launch my basic script, the Python shell opens and closes immediately without any error message.

I downloaded Selenium directly from https://pypi.org/project/selenium/, unzipped it and click on setup.py. No error message, just the CMD Windows with "Please press any button".

I downloaded the webdriver for:

  1. Chrome - Version 89.

  2. Firefox vers 78.6.1esr (64-Bit), just downloaded the last version 0.29.0 - https://github.com/mozilla/geckodriver/releases

I put everything in the same order (driver, Selenium, code to execute), see screenshot: Screenshot

Here is the code for Firefox:

from selenium import webdriver

browser = webdriver.Firefox()
browser.get('https://www.google.com')

I also tried by giving directly the path of the Driver without success :

from selenium import webdriver

browser = webdriver.Firefox('C:\Users\Bast01\Desktop\Python\Selenium Test\geckodriver.exe')
browser.get('https://www.google.com')

I even don't know if Selenium is corretly installed, for example:

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help("selenium")
No Python documentation found for 'selenium'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

>>> help("Selenium")
No Python documentation found for 'Selenium'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

Thank you for your help !

2
  • There seems to be a lot of different questions lumped together here. Is your first trouble-shooting question actually something like “How do I check if Selenium is correctly installed?” Commented Apr 2, 2021 at 21:37
  • My question would be: according to these informations, can anyone tell why it's not working ? Thanks ! Commented Apr 2, 2021 at 21:40

1 Answer 1

1

just install selenium from the pip repository directly than trying to build it from source.

use

 pip install selenium

now if you do help("selenium")

you gets:

enter image description here

if you still want to install using setup.py then use below method:

open selenium-3.141.0\selenium-3.141.0 ( the extracted ) folder where setup.py was the current directory in cmd/terminal and then run

 pip install .

or

 python setup.py install
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.