I have following code:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://google.com")
This code works well except that it is really slow. I don´t use the ChromeDriver. Just the normal Chrome Browser on my Mac. Why do I have to download the ChromeDriver? It doesn´t speed up the code execution. I've already tried that.
Also:
Why do I have to close the driver at the end of my programm with driver.close()
?
The browser closes automatically when the code is finished.
Thank you!
Your code is perfectly fine.
selenium version > 4.12.0
There is no need to download the chromedriver manually,
Selenium's new in-built tool Selenium Manager will automatically download and manage the drivers for you.
https://www.selenium.dev/documentation/selenium_manager/ https://www.selenium.dev/blog/2023/status_of_selenium_manager_in_october_2023/
You do not have to use driver.close()
with the above code.
ChromeDriver is necessary for communication between Selenium and the Chrome browser. While it's true that downloading the ChromeDriver doesn't necessarily speed up the execution of your code, it is a critical component for Selenium to interact with the browser. Without ChromeDriver, Selenium won't be able to control the Chrome browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With