GithubHelp home page GithubHelp logo

leonidessaguisagjr / webdriverdownloader Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 17.0 27 KB

Python module to facilitate downloading and deploying WebDriver binaries. Currently supporting geckodriver, chromedriver and operachromiumdriver.

Home Page: https://pypi.org/project/webdriverdownloader/

License: MIT License

Python 100.00%
selenium-webdriver python python3 python3-library python-library downloader geckodriver-binary chromedriver-binary

webdriverdownloader's People

Contributors

kimfaint avatar leonidessaguisagjr avatar leydenjar avatar roy-n-roy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

webdriverdownloader's Issues

Github API rate limit exceeded error

When I run python script with webdriverdownloader too much, this error starts to appear:

Traceback (most recent call last):
  File "D:\source\projects\reddit-account-generator\create_accounts.py", line 39, in <module>
    install_driver()
  File "D:\source\projects\reddit-account-generator\reddit_account_generator\__init__.py", line 13, in install_driver
    webdriverdownloader.GeckoDriverDownloader().download_and_install()
  File "D:\Programs\Python3.11.0\Lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 174, in download_and_install
    filename_with_path = self.download(version,
                         ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\Python3.11.0\Lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 129, in download
    download_url = self.get_download_url(version, os_name=os_name, bitness=bitness)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\Python3.11.0\Lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 318, in get_download_url
    raise RuntimeError(info_message)
RuntimeError: Error, unable to find a download for os: win

Looking into the code I realized that your library makes a request to the page below each time, where the following error appears:

изображение

I suggest a solution: cache requests or add some proper error for this scenario, for example "You have exceeded the request limit, try again later"

No coder having problems running on mac

Hello,

Let me start by telling that my coding journey started today.

i followed all guidance to install python and instapy on my mac.

when I try to run the script I get an error

`instagrambot av$ python3 instagrambot.pyTraceback (most recent call last): File "/Users/av/Desktop/InstagramBot/instagrambot.py", line 7, in session = InstaPy(username = my_username,TypeError: init() got an unexpected keyword argument 'headLess_browser'

I then followed your instruction of

filename = [name for name in filenames if os_name + bitness in name and name[-7:] == '.tar.gz' ]

Now I'm having another error

InstaPy Version: 0.6.13
.. .. .. .. .. .. .. ..
Workspace in use: "/Users/av/InstaPy"
Error, unable to determine correct filename for 64bit macos
Traceback (most recent call last):
File "/Users/av/Desktop/InstagramBot/instabot.py", line 7, in
session = InstaPy(username=my_username,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/instapy/instapy.py", line 325, in init
self.browser, err_msg = set_selenium_local_session(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/instapy/browser.py", line 122, in set_selenium_local_session
driver_path = geckodriver_path or get_geckodriver()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/instapy/browser.py", line 38, in get_geckodriver
sym_path = gdd.download_and_install()[1]
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader.py", line 174, in download_and_install
filename_with_path = self.download(version,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader.py", line 129, in download
download_url = self.get_download_url(version, os_name=os_name, bitness=bitness)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader.py", line 324, in get_download_url
raise RuntimeError(info_message)
RuntimeError: Error, unable to determine correct filename for 64bit macos
AVs-MacBook-Pro-001:instagrambot av$

Can you help me please.

I set the headless_browser=True so I can run the script for multiple accounts at the same time.

Thank you

downloading geckodriver fails on macOS

When trying to download the geckodriver either through script or CLI on macOS, there is the following error:

RuntimeError: Error, unable to determine correct filename for 64bit macos

Not adding in PATH when running

Hey,

first of all, amazing job with this project. I have been using chromedriver_binary, but as I searched for firefox, I ended up seeing your project.

I saw this behaviour:

from webdriverdownloader.webdriverdownloader import GeckoDriverDownloader
from selenium import webdriver

GeckoDriverDownloader().download_and_install()
b = webdriver.Firefox()
b.close()


~/git_ramon/webdriverdownloader/.env/lib/python3.7/site-packages/selenium/webdriver/common/service.py in start(self)
     81                 raise WebDriverException(
     82                     "'%s' executable needs to be in PATH. %s" % (
---> 83                         os.path.basename(self.path), self.start_error_message)
     84                 )
     85             elif err.errno == errno.EACCES:

WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

So, should I do something more to put on path?

Set custom DownloadPath

Hi,
is is possible to set a custom DownloadPath to the download() and download_and_install() Methods eg. for Virtuals Environment would be great!

GeckoDriverDownloader get_download_path() error

gdd.get_download_path()
File "C:\Program Files\Python37\lib\site-packages\webdriverdownloader\webdriverdownloader.py", line 264, in get_download_path
return os.path.join(self.download_root, "gecko", ver)
UnboundLocalError: local variable 'ver' referenced before assignment

CERTIFICATE_VERIFY_FAILED when downloading ChromeDriver

OS: MacOs
Python version. 3.9.2
webdriverdownloader: 1.1.0.3

I receive the following when trying to download the Chrome driver:
SSLError: HTTPSConnectionPool(host='www.googleapis.com', port=443): Max retries exceeded with url: /storage/v1/b/chromedriver/o/LATEST_RELEASE (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))
This does not happen when using Firefox.

Also, doing this on Windows does not invoke error also.
Do you think it's a good idea to not verify the certificates when downloading the drivers?

I opened a PR just in case: #16

Cannot download chromedriver for versions 115 and above

The current version of chrome is 120, but the latest version this tool downloads is 114:

$ webdriverdownloader chrome
Downloading WebDriver for browser: 'chrome'
Symlink /home/kim/bin/chromedriver already exists and will be overwritten.
Driver binary downloaded to: /home/kim/webdriver/chrome/114.0.5735.90/114.0.5735.90%2Fchromedriver_linux64/chromedriver
Symlink created: /home/kim/bin/chromedriver

If we try to specify a newer version that 114 if fails with runtime error:

$ webdriverdownloader chrome:115
Downloading WebDriver for browser: 'chrome'
Error, unable to find appropriate download for linux64.
Traceback (most recent call last):
  File "/home/kim/.local/share/virtualenvs/webdriverdownloader-MSPgnHFF/bin/webdriverdownloader", line 33, in <module>
    sys.exit(load_entry_point('webdriverdownloader==1.1.0.3', 'console_scripts', 'webdriverdownloader')())
  File "/home/kim/.local/share/virtualenvs/webdriverdownloader-MSPgnHFF/lib/python3.8/site-packages/webdriverdownloader-1.1.0.3-py3.8.egg/webdriverdownloader/cli.py", line 44, in main
    extracted_binary, link = downloader.download_and_install(version)
  File "/home/kim/.local/share/virtualenvs/webdriverdownloader-MSPgnHFF/lib/python3.8/site-packages/webdriverdownloader-1.1.0.3-py3.8.egg/webdriverdownloader/webdriverdownloader.py", line 174, in download_and_install
    filename_with_path = self.download(version,
  File "/home/kim/.local/share/virtualenvs/webdriverdownloader-MSPgnHFF/lib/python3.8/site-packages/webdriverdownloader-1.1.0.3-py3.8.egg/webdriverdownloader/webdriverdownloader.py", line 129, in download
    download_url = self.get_download_url(version, os_name=os_name, bitness=bitness)
  File "/home/kim/.local/share/virtualenvs/webdriverdownloader-MSPgnHFF/lib/python3.8/site-packages/webdriverdownloader-1.1.0.3-py3.8.egg/webdriverdownloader/webdriverdownloader.py", line 403, in get_download_url
    raise RuntimeError(error_message)
RuntimeError: Error, unable to find appropriate download for linux64.

The reason for this is for version 115 and beyond there is a new method to download chromedriver binaries, see https://chromedriver.chromium.org/downloads:

If you are using Chrome version 115 or newer, please consult the Chrome for Testing availability dashboard. This page provides convenient JSON endpoints for specific ChromeDriver version downloading.

I have forked this repo and will be working on a PR to fix this and use the new endpoints for chrome versions >= 115.

Failed to download geckodriver

Sometimes webdriverdownloader fails to download geckodriver inside travis ci:

RuntimeError: Error, unable to get info for gecko driver v0.20.1 release. Status code: 403

It can fail on different python versions. Here https://travis-ci.org/RedHatQE/widgetastic.core/builds/436013142 you can see how it failed on python 2.7 and 3.6. On the other side usual wget does the job without issues https://travis-ci.org/RedHatQE/widgetastic.core/builds/436020614. But it requires to write bash script inside .travis.yml.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.