leonidessaguisagjr / webdriverdownloader

Python module to facilitate downloading and deploying WebDriver binaries. Currently supporting geckodriver, chromedriver and operachromiumdriver.
https://pypi.org/project/webdriverdownloader/
MIT License
20 stars 17 forks source link

Bug fix, the URLs of the fallback download methods are incorrect. #10

Closed roy-n-roy closed 10 months ago

roy-n-roy commented 4 years ago

On GeckoDriver and OperaChromiumDriver, the fallback download URL when the GitHub API call fails is wrong and it doesn't download well.

The error was caused by the following source code.

resp = requests.get(gecko_driver_version_release_ui_url, allow_redirects=True)
if resp.status_code == 200:
    json_data = {"assets": []}
soup = BeautifulSoup(resp.text, features="html.parser")
urls = [resp.url + a['href'] for a in soup.find_all('a', href=True) if r"/download/" in a['href']]

When I ran it, the value of resp.url was https://github.com/mozilla/geckodriver/releases/tag/v0.26.0, and the value of a['href'] was /mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz.

So, I modified it as follows.

If you're okay with it, please merge this PR.