Home > Enterprise >  Python Selenium with Chrome takes 2 minutes to start?
Python Selenium with Chrome takes 2 minutes to start?

Time:04-10

in python I have:

driver = webdriver.Chrome(desired_capabilities=caps, service=Service(ChromeDriverManager().install()),
                                  options=chrome_options)

which takes a very very long time to finish, I took a look at my terminal and here is what I see:

====== WebDriver manager ======
Current google-chrome version is 100.0.4896
Get LATEST chromedriver version for 100.0.4896 google-chrome

Driver [/Users/Roi/.wdm/drivers/chromedriver/mac64/100.0.4896.60/chromedriver] found in cache

Where the last line is printed after 2 minutes....

NOTE: this problem wasn't happening 1 week ago, I don't know what have changed since then...

CodePudding user response:

As you are using Webdriver Manager for Python ChromeDriverManager will always check for the latest installed within your system and subsequently check if the matching chromedriver is available in your system cache.

Further desired_capabilities property is deprecated in favour of capabilities property since Selenium 4.0 Alpha 7:

  • Deprecate desired_capabilities property in favour of capabilities property

Solution

The exection kickoff time can be optimized by merging the desired_capabilities and options which is available since Selenium 4.0 Beta 1:

  • Improve how desired_capabilities and options are merged
  • Related