I try to run Selenium in Python but the driver is not recognized. When I give it CTRL+B I get it right away [Finished in 1.3s]
and it doesn't open the browser. The path is exactly where the driver is.
Code:
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r"C:\driver_chrome\chromedriver.exe")
driver.get("http://www.python.org")
driver.close()
Result:
[Finished in 1.3s]
One possibility may be that the browser is closing as soon as it is opening because it has no instruction to stop execution.
On the other hand, check that the driver version corresponds to the version of Chrome that the device has installed. Then:
1- Download Selenium from trusted source:
2- Download the corresponding Chromedriver . Do not download a bigger one because it may not be stable or work well with the previous version of the browser.
With that code, the page should display for 5 seconds and then close.