2

From my knowledge, there are two ways to use a chrome driver with selenium in python:

  1. either by downloading the chromedriver.exe, then by integrating it into the parameter:

    browser = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe")
    
  2. either by installing chromedriver_binary via

    pip install chromedriver-binary
    

    in this case no more need to configure the instantiation of chrome driver

    browser = webdriver.Chrome()
    

My question is which is the most efficient method in terms of execution time? Which of these two methods do you recommend?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Shrmn
  • 368
  • 4
  • 12

1 Answers1

1

chromedriver-binary

chromedriver-binary downloads and installs the chromedriver binary version 97.0.4692.36 for automated testing of webapps. The installer supports Linux, MacOS and Windows operating systems.

  • To install:

    pip install chromedriver-binary
    
  • Usage: To use chromedriver you need the following import:

    import chromedriver_binary
    

    This will add the executable to your PATH so it will be found. You can also get the absolute filename of the binary using:

    chromedriver_binary.chromedriver_filename
    

However with Selenium v3.x you can download the ChromeDriver and use the key executable_path to pass the absolute path of the ChromeDriver.

browser = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe")

Conclusion

There is no best practices defined neither any efficiency matrix comparing the two approaches. It's the user perspective of comfortness. The only bonus point using executable_path is, you don't require to install any additional package.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352