Closed jiacwjcw closed 3 years ago
looks good, ill check it a bit in detail later and merge .. thanks for this!
Sounds great, thanks for helping to review.
Code, just for gecko is fine but i need to still verify something.
Essentially, the place where this is fixed is in base class of downloader - same piece of code is also used for opera chromium drivers and if it has its own convention to separate arm & intel macs (for which there is no support yet), this patch can cause issues..
Ill still peek over this the weekend and probably merge as is and deal with opera later.
Hi @rasjani,
Currently, I think it's okay to get the opera chromium because of there is just only one source of opera chromium so that it couldn't be executed in to if len(filename) > 1: ...
in line 188 of base.py
.
I add some "print" logs to show filenames
and filename
, It passed to get the opera for macOS now.
python -m unittest test/acceptance/test_opera.py
test_download ['operadriver_linux64.zip', 'operadriver_mac64.zip', 'operadriver_win32.zip', 'operadriver_win64.zip'] ['operadriver_mac64.zip']
test_download_and_install .['operadriver_linux64.zip', 'operadriver_mac64.zip', 'operadriver_win32.zip', 'operadriver_win64.zip'] ['operadriver_mac64.zip']
test_download .['operadriver_linux64.zip', 'operadriver_mac64.zip', 'operadriver_win32.zip', 'operadriver_win64.zip'] ['operadriver_mac64.zip']
test_download_and_install .['operadriver_linux64.zip', 'operadriver_mac64.zip', 'operadriver_win32.zip', 'operadriver_win64.zip'] ['operadriver_mac64.zip']
Ran 4 tests in 10.263s
OK
[FIX]: Fix for unable to get the webdriver through the mac device due to adding m1 build in v0.29.1
Hello, I've found the issue during downloading geckodriver via mac in v0.29.1, it'll always print this log:
raise_runtime_error(f"Error, unable to determine correct filename for {self.bitness}bit {self.os_name}")
After execute pytest of
test_gecko.py
, the following logs are the same as above log I said:ERROR: test_download (test.acceptance.test_gecko.GeckoDriverManagerTestsWithAutomaticLocations)
Traceback (most recent call last): File "/Users/jiacw/Documents/Amazon/webdrivermanager/test/acceptance/test_gecko.py", line 16, in test_download filename = self.instance.download(show_progress_bar=False) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 228, in download (download_url, filename) = self.get_download_url(version) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/gecko.py", line 55, in get_download_url url = self._parse_github_api_response(version, response) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 185, in _parse_github_api_response raise_runtime_error(f"Error, unable to determine correct filename for {self.bitness}bit {self.os_name}") File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/misc.py", line 22, in raise_runtime_error raise RuntimeError(msg) RuntimeError: Error, unable to determine correct filename for 64bit mac
ERROR: test_download_and_install (test.acceptance.test_gecko.GeckoDriverManagerTestsWithAutomaticLocations)
Traceback (most recent call last): File "/Users/jiacw/Documents/Amazon/webdrivermanager/test/acceptance/test_gecko.py", line 22, in test_download_and_install driver_link_target, driver_binary = self.instance.download_and_install(show_progress_bar=False) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 291, in download_and_install filename_with_path = self.download(version, show_progress_bar=show_progress_bar, force=force) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 228, in download (download_url, filename) = self.get_download_url(version) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/gecko.py", line 55, in get_download_url url = self._parse_github_api_response(version, response) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 185, in _parse_github_api_response raise_runtime_error(f"Error, unable to determine correct filename for {self.bitness}bit {self.os_name}") File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/misc.py", line 22, in raise_runtime_error raise RuntimeError(msg) RuntimeError: Error, unable to determine correct filename for 64bit mac
ERROR: test_download (test.acceptance.test_gecko.GeckoDriverManagerTestsWithExplicitLocations)
Traceback (most recent call last): File "/Users/jiacw/Documents/Amazon/webdrivermanager/test/acceptance/test_gecko.py", line 33, in test_download filename = self.instance.download(show_progress_bar=False) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 228, in download (download_url, filename) = self.get_download_url(version) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/gecko.py", line 55, in get_download_url url = self._parse_github_api_response(version, response) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 185, in _parse_github_api_response raise_runtime_error(f"Error, unable to determine correct filename for {self.bitness}bit {self.os_name}") File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/misc.py", line 22, in raise_runtime_error raise RuntimeError(msg) RuntimeError: Error, unable to determine correct filename for 64bit mac
ERROR: test_download_and_install (test.acceptance.test_gecko.GeckoDriverManagerTestsWithExplicitLocations)
Traceback (most recent call last): File "/Users/jiacw/Documents/Amazon/webdrivermanager/test/acceptance/test_gecko.py", line 40, in test_download_and_install driver_link_target, driver_binary = self.instance.download_and_install(show_progress_bar=False) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 291, in download_and_install filename_with_path = self.download(version, show_progress_bar=show_progress_bar, force=force) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 228, in download (download_url, filename) = self.get_download_url(version) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/gecko.py", line 55, in get_download_url url = self._parse_github_api_response(version, response) File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/base.py", line 185, in _parse_github_api_response raise_runtime_error(f"Error, unable to determine correct filename for {self.bitness}bit {self.os_name}") File "/Users/jiacw/Documents/Amazon/webdrivermanager/src/webdrivermanager/misc.py", line 22, in raise_runtime_error raise RuntimeError(msg) RuntimeError: Error, unable to determine correct filename for 64bit mac
Ran 4 tests in 3.756s
FAILED (errors=4)
Because there are no any handling to get the correct version between "m1" and "intel" version for Mac device.
As above discussed, I added some functions in
base.py
to identify what the CPU type is on your device so that it could success to get the correct file which would be downloaded to your device.def get_mac_cpu_type(self): ...
filename = [name for name in filenames if "aarch64" in name] if mac_cpu_type is "arm" else [name for name in filenames if "aarch64" not in name]
Testing
python -m unittest test/acceptance/test_gecko.py
Ran 4 tests in 9.137s