How to get the ChromeDriver automatically updated through Python selenium after compiling using Pyinstaller
Asked Answered
E

4

5

I use to pack the Chromedriver into my exe package too but as people say it changes quite frequently.

So I try the auto check for update method using the selenium import webdriver which also worked like a dream in the IDE however when I compile the code to exe file using Pyinstaller method it then falls and will no longer download the update to my temp MEIPASS location where I later execute the driver for the remainin part of my program.
Could this be windows some how blocking this type of request now it is within an exe file?

Just as an update here it is probably because I am unsure where the autoupdater extracts the new chromedrive to does anybody know where the driver will be placed when it updates?

Encratia answered 2/2, 2021 at 22:20 Comment(0)
M
12

There is a python pakage called chromedriver-autoinstaller. It can be used to auto-update chromedriver You can install it by using pip install chromedriver-autoinstaller command.

import chromedriver_autoinstaller


chromedriver_autoinstaller.install()  # Check if the current version of chromedriver exists
                                      # and if it doesn't exist, download it automatically,
                                      # then add chromedriver to path
Manche answered 9/2, 2021 at 3:8 Comment(3)
thanks for the info, I eventually found some code that I could implement into my existing code. Basically it has links to go check if there is an update if so download it to the folder where the user installs my exe file. with a bit of jigging around with the overall program I got it working ok so far..Encratia
can we make this executable?Fireeater
@Fireeater Yes we can make it executable using pyinstallerManche
S
7

webdriver-auto-update

There is a package in PyPI and GitHub called webdriver-auto-update, that you could use for a simple and effective way to download chrome driver automatically.

Program Functionality

  1. Detects local chromedriver driver version on your computer and compares it with the latest version available online.
  2. The latest online version/release will be downloaded automatically if it does not match your local version.

Installation: Make sure you have Python installed in your system. Run the following in your terminal to install: pip install webdriver-auto-update

Example

from selenium import webdriver
from webdriver_auto_update import check_driver


# Pass in the folder used for storing/downloading chromedriver
check_driver('folder/path/of/your/chromedriver')

driver = webdriver.Chrome()
driver.get("http://www.python.org")

Reference link:

https://pypi.org/project/webdriver-auto-update/ https://github.com/competencytestlvl/webdriver_auto_update

Sagacity answered 2/10, 2021 at 14:2 Comment(0)
V
0

You just need to pip uninstall webdriver-manager and after pip install webdriver-manager, and it´s done.

Venn answered 1/8, 2023 at 4:37 Comment(0)
R
0

Don't forget to open your firewall. As of 9/10/24, nslookup shows these locations:

2607:f8b0:4009:81b::201b
          2607:f8b0:4009:818::201b
          2607:f8b0:4009:819::201b
          2607:f8b0:4009:81a::201b
          172.217.2.59
          172.217.4.91
          172.217.4.219
          172.217.4.59
          172.217.5.27
          142.250.190.27
          142.250.190.59
          142.250.190.91
          142.250.190.123
          142.250.190.155
          142.250.191.123
          142.250.191.187
          142.250.191.219
          142.250.191.251
          172.217.0.187
          172.217.1.123

I assume port 443.

Rheometer answered 10/9, 2024 at 18:58 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Comedo

© 2022 - 2025 — McMap. All rights reserved.