Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Unable to update to 4.11.0 (Python) #12458

Closed
yusancky opened this issue Aug 1, 2023 · 5 comments
Closed

[🐛 Bug]: Unable to update to 4.11.0 (Python) #12458

yusancky opened this issue Aug 1, 2023 · 5 comments

Comments

@yusancky
Copy link

yusancky commented Aug 1, 2023

What happened?

My code has worked fine in the last few versions including 4.10.0. But when the bot tried to upgrade the dependency to 4.11.0, the problem appeared: the error said "Unable to locate or obtain driver for chromeUnable to locate or obtain driver for chrome".

How can we reproduce the issue?

build.py

# Copyright (c) yusancky. All rights reserved. 
# Licensed under the Apache License 2.0. See License in the project root for license information. 

import AllUp_utils.web

if __name__ == '__main__':
    chromedriver = AllUp_utils.web.configure_chromedriver()

AllUp_utils/web.py

# Copyright (c) yusancky. All rights reserved. 
# Licensed under the Apache License 2.0. See License in the project root for license information. 

from requests import get
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

def configure_chromedriver():
    chrome_service = Service('/usr/local/share/chrome_driver/chromedriver')
    chrome_options = Options()
    for option in ['--headless','--disable-gpu','--window-size=1920,1200','--ignore-certificate-errors','--disable-extensions','--no-sandbox','--disable-dev-shm-usage']:
        chrome_options.add_argument(option)
    return webdriver.Chrome(service = chrome_service,options = chrome_options)

def fetch_data(url,need_selenium = False):
    if need_selenium:
        need_selenium.get(url)
        return need_selenium.page_source
    else:
        response = get(url)
        return response.text

Relevant log output

Traceback (most recent call last):
  File "/home/runner/work/AllUp-Satwiki/AllUp-Satwiki/build.py", line 41, in <module>
    chromedriver = AllUp_utils.web.configure_chromedriver()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/AllUp-Satwiki/AllUp-Satwiki/AllUp_utils/web.py", line 14, in configure_chromedriver
    return webdriver.Chrome(service = chrome_service,options = chrome_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 51, in __init__
    self.service.path = DriverFinder.get_path(self.service, options)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/selenium/webdriver/common/driver_finder.py", line 44, in get_path
    raise NoSuchDriverException(f"Unable to locate or obtain driver for {options.capabilities['browserName']}")
selenium.common.exceptions.NoSuchDriverException: Message: Unable to locate or obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

Operating System

Ubuntu 22.04

Selenium version

Python 4.11.0

What are the browser(s) and version(s) where you see this issue?

Chrome 115.0.5790.102

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 115.0.5790.102

Are you using Selenium Grid?

No response

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

@yusancky, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@yusancky yusancky changed the title [🐛 Bug]: Unable to update to 3.11.0 (Python) [🐛 Bug]: Unable to update to 4.11.0 (Python) Aug 1, 2023
@titusfortner
Copy link
Member

That's this bug - GoogleChromeLabs/chrome-for-testing#30

You do not need to specify a driver location or manage drivers yourself with Selenium 4.11. Remove the references to chrome_service in the above code and it will work.

@anuragkumar201002
Copy link

Message: unknown error: Chrome failed to start: exited abnormally

@titusfortner
Copy link
Member

@anuragkumar201002 turn on logging and see what the problem is. If it looks like a bug, file a new issue here.

https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/

Copy link

github-actions bot commented Dec 6, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants