SergeyPirogov / webdriver_manager

Apache License 2.0
2.03k stars 453 forks source link

Problem with creating the driver #672

Open marchqbismart opened 1 month ago

marchqbismart commented 1 month ago

Hello,

I'm using selenium and the webdriver_manager package for a bot. I'm currently using it in a function app with python in docker, locally. I had the problem of the THIRD_PARTY file but it's already solved.

Now, if I run the function locally (without docker) it goes okey, but runnig it in docker, it keeps running in the driver creation and keeps 10 minutes charging untill it stops automatically. The function was working some days ago before the version of Chrome changed...

There's someone with the same problem?

Code here:

user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.88 Safari/537.36 Edg/95.0.1020.30"

    chrome_options = webdriver.ChromeOptions()
    download_directory = os.path.join(os.getcwd(), 'files')
    download_directory2 = os.path.join(os.getcwd(), 'screenshots')

    if not os.path.exists(download_directory):
        os.makedirs(download_directory)

    if not os.path.exists(download_directory2):
        os.makedirs(download_directory2)

    prefs = {'download.default_directory': download_directory}
    chrome_options.add_experimental_option('prefs', prefs)
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--disable-dev-shm-usage")
    chrome_options.add_argument("--window-size=1920x1080")
    chrome_options.add_argument(f"user-agent={user_agent}")

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

The problem is in the last line, the service is correctly created.

glsch commented 1 month ago

I have the same issue. Hard-coding the driver path, the one of the previous version of the driver, and skipping installation step altogether helped.

SacrilegeTx commented 1 month ago

Where can I find the chromedriver for chrome version=127? ERROR - Message: session not created: This version of ChromeDriver only supports Chrome version 114 Current browser version is 127.0.6533.73 with binary path

glsch commented 1 month ago

I was running my script every day and I had quite a collection of older drivers stored in a specific folder (YOUR_USER_FOLDER/.wdm/drivers/chromedriver/... on Mac).

praditik commented 1 month ago

Same error. This needs resolution OR the chrome is not usable by webdriver_manager anymore as of this version.

CalebePrates commented 1 month ago
chrome_path = ChromeDriverManager().install()
if "THIRD_PARTY_NOTICES.chromedriver" in chrome_path:
    chrome_path = chrome_path.replace("THIRD_PARTY_NOTICES.chromedriver", "chromedriver")