0

vscode says it run but it does nothing. My pip is up to date and i installed selenium with the command prompt. i have a valid path (i think) for chromedriver. Here's my code:

from selenium import webdriver
chromedriver = "C:Users/P-Lou/Downloads/chromedriver.exe"
driver = webdriver.Chrome(chromedriver)
driver.get("http:google.com")

The result is this:

[Running] python -u "w:\Python\Seletest\app.py"

[Done] exited with code=0 in 0.067 seconds
5
  • What do you mean by "it does nothing"? Just from the code you posted, it is not supposed to do anything. Also, the url does not look correct. Instead, http://google.com should be it, I think. Commented Dec 1, 2020 at 13:54
  • it is supposed to open google but it doesnt. I changed the adress and still no responce. Commented Dec 1, 2020 at 13:56
  • 1
    Not a Selenium expert but it looks like all your code is telling it to do is go onto the Google homepage. You may be running a headless browser in which case there wont be a visible window that pops up on your screen. Try telling it to get elements from the page and examine what it finds. Commented Dec 1, 2020 at 13:58
  • its a good idea but it did nothing. i tried to run it in mcrosoft visual studio instead and mow my error message is: Message: 'chromedriver.exe' executable needs to be in PATH. Please see sites.google.com/a/chromium.org/chromedriver/home Commented Dec 1, 2020 at 14:03
  • Try using the following: chromedriver = r"C:Users/P-Lou/Downloads/chromedriver.exe" Commented Dec 1, 2020 at 17:34

3 Answers 3

1

I tried this code by only changing the browser to firefox and removing the chromedriver = part and it worked fine, you might be running the browser in headless mode, thats why nothing pops up. You can change that using The Chromedriver.options(set_headless="false") (not sure if that is the right code, you can check yourself here)

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

Comments

0

Presuming the ChromeDriver binary location being C:\Users\P-Lou\Downloads on your system you can use the following solution:

from selenium import webdriver

driver = webdriver.Chrome(executable_path=r'C:\Users\P-Lou\Downloads\chromedriver.exe')
driver.get("http:google.com")

Comments

0

For me, I accidentally downloaded chrome binary instead of chromedriver binary from Google Chrome Labs.

Chromedriver is very small in size (around 8-10 MB as of 1/10/2025).

You also need to download the Official Chrome Browser from Google in your operating system (I had Brave installed so I had to download Chrome).

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.