1
from selenium import webdriver

driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
driver.get("https://www.google.com/")

Hello, I am new to selenium and i have got this problem: My Chrome Browser opens, but it is not going to open google.com or any other website. I tried to print something out after opening the webdriver, but nothing happens. Why is my program stopping after opening the browser?

2 Answers 2

2

WebDriver path should be passed as an additional parameter to chromedriver.exe as below:

driver = webdriver.Chrome(executable_path=r"C:\TestFiles\chromedriver.exe")
driver.get("https://www.google.com/")

ChromeDriver can be obtained from: http://chromedriver.chromium.org/downloads Please make sure that Your webdriver is compatible with Your Chrome browser.

I hope that this will help You :)

0

My question would be, which Chrome version you are using? ChromeDriver uses the same version number scheme as Chrome. So, make sure that the chrome driver you are using is compatible with the Chrome browser you are trying to open. Also, one of the good way to use the chrome drive is to keep it directly in C Drive, it has many benefits.

As a newbie you can start with the below code and it should work.

from selenium import webdriver
driver = webdriver.Chrome ("C:\\chromedriver.exe")
driver.get('http://www.google.com')

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.