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

Fix unhandled AttributeError when chrome browser version cannot be determined #638

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sebthom
Copy link

@sebthom sebthom commented Oct 15, 2023

Traceback (most recent call last):
  ...
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\chrome.py", line 40, in install
    driver_path = self._get_driver_binary_path(self.driver)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\core\manager.py", line 40, in _get_driver_binary_path
    file = self._download_manager.download_file(driver.get_driver_download_url(os_type))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\drivers\chrome.py", line 32, in get_driver_download_url
    driver_version_to_download = self.get_driver_version_to_download()
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\core\driver.py", line 48, in get_driver_version_to_download
    return self.get_latest_release_version()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\drivers\chrome.py", line 64, in get_latest_release_version
    determined_browser_version = ".".join(determined_browser_version.split(".")[:3])
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

…termined

```py
Traceback (most recent call last):
  ...
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\chrome.py", line 40, in install
    driver_path = self._get_driver_binary_path(self.driver)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\core\manager.py", line 40, in _get_driver_binary_path
    file = self._download_manager.download_file(driver.get_driver_download_url(os_type))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\drivers\chrome.py", line 32, in get_driver_download_url
    driver_version_to_download = self.get_driver_version_to_download()
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\core\driver.py", line 48, in get_driver_version_to_download
    return self.get_latest_release_version()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\app\__pypackages__\3.12\lib\webdriver_manager\drivers\chrome.py", line 64, in get_latest_release_version
    determined_browser_version = ".".join(determined_browser_version.split(".")[:3])
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'
```
@pep8speaks
Copy link

Hello @sebthom! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 67:80: E501 line too long (107 > 79 characters)
Line 68:80: E501 line too long (92 > 79 characters)
Line 69:80: E501 line too long (91 > 79 characters)

@sebthom
Copy link
Author

sebthom commented Oct 15, 2023

@SergeyPirogov I don't think the PEP8 line length check is very helpful if the whole file already violates the rule.

@bandophahita
Copy link

@sebthom I ran into the same thing. I was faced with either ignoring it because the file already existed that way or make a bunch of changes unrelated to my PR.

@bandophahita
Copy link

I recommend trying to build a unit test for this.

@sxaxmz
Copy link

sxaxmz commented Dec 27, 2023

Issue still presist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants