Giter Site home page Giter Site logo

webdriver_manager's Introduction

Hi 👋, I'm Sergey

A passionate QA Automation Lead/QA Manager from Ukraine

  • 🔭 I’m currently working on webdriver-manager

  • 🌱 I’m currently learning NodeJs, TypeScript, Vue

  • 👯 I’m looking to collaborate on Reqover

  • 💬 Ask me about testing and test automation process

  • 📫 Reach me [email protected]

Let's Connect and have a Chat!💬

🚀  Some Tools I Have Used and Learned

docker java javascript jenkins linux postgresql puppeteer python selenium

webdriver_manager's People

Contributors

aleksandr-kotlyar avatar alexander-gridnev avatar amankul avatar andrewvaughan avatar arturshevchenkoyalantis avatar arunabalasubramanian avatar daemo00 avatar dependabot[bot] avatar encacz avatar faissaloux avatar gospodinkot avatar harishankarindora avatar hobbymarks avatar janringas avatar jayph88 avatar jhawgs avatar lettow-humain avatar maratori avatar markbrook avatar mjblue avatar mskozlova avatar nakami avatar ndepaola avatar olegchursin avatar punitarani avatar raffaem avatar s-weigand avatar sam-goode avatar sergeypirogov avatar wwakabobik avatar

Stargazers

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

Watchers

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

webdriver_manager's Issues

__str__ returned non-string (type function)

Getting this error on scrapinghub. Works okay locally. Any ideas?

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/scrapy/utils/defer.py", line 102, in iter_errback
    yield next(it)
  File "/usr/local/lib/python3.6/site-packages/sh_scrapy/middlewares.py", line 30, in process_spider_output
    for x in result:
  File "/usr/local/lib/python3.6/site-packages/scrapy/spidermiddlewares/offsite.py", line 29, in process_spider_output
    for x in result:
  File "/usr/local/lib/python3.6/site-packages/scrapy/spidermiddlewares/referer.py", line 22, in <genexpr>
    return (_set_referer(r) for r in result or ())
  File "/usr/local/lib/python3.6/site-packages/scrapy/spidermiddlewares/urllength.py", line 37, in <genexpr>
    return (r for r in result or () if _filter(r))
  File "/usr/local/lib/python3.6/site-packages/scrapy/spidermiddlewares/depth.py", line 58, in <genexpr>
    return (r for r in result or () if _filter(r))
  File "/tmp/unpacked-eggs/__main__.egg/scraper/spiders/instagram.py", line 108, in parse
    driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
  File "/app/python/lib/python3.6/site-packages/webdriver_manager/firefox.py", line 18, in install
    return self._file_manager.download_driver(self.driver, path).path
  File "/app/python/lib/python3.6/site-packages/webdriver_manager/cache.py", line 70, in download_driver
    cached_binary = self.get_cached_binary(driver, path)
  File "/app/python/lib/python3.6/site-packages/webdriver_manager/cache.py", line 40, in get_cached_binary
    console("")
  File "/app/python/lib/python3.6/site-packages/webdriver_manager/utils.py", line 44, in console
    print(crayons.yellow(text, bold=bold))
TypeError: __str__ returned non-string (type function)

Failing tests in tests/test_firefox_manager.py

  • test_can_download_firefox_driver
  • test_gecko_manager_with_correct_version
  • test_gecko_manager_with_selenium
  • test_gecko_manager_with_wrong_version
  • test_gecko_manager_with_correct_version_and_token
API rate limit exceeded for 35.192.187.174. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
  • test_can_download_ff_x64
  • test_can_get_driver_from_cache
Bad credentials

Originally posted by @Klemek in #57 (comment)

How to get to edge latest update ?

Hello,

This is more of a question than an issue. How did you get the latest version of edge? I looked at your default.ini but that link is dead for Microsoft edge. I was thinking about scraping Microsoft website to get the latest one but i think i will ask around first before doing such inefficient method.

Thank you for any info,

Loc

Unable to install webdriver-manager using jython setup.py install command, gives zip_safe flag not set; analyzing archive contents...

The following steps can be used to reproduce the issue,

  1. clone git repo
  2. run jython setup.py install

O/P

[2019-11-19 13:39.52] /cygdrive/c/gii/webdriver_manager-master
[kgurupra.KGURUPRA-IN] ➤ jython setup.py install
running install
running bdist_egg
running egg_info
creating webdriver_manager.egg-info
writing dependency_links to webdriver_manager.egg-info\dependency_links.txt
writing top-level names to webdriver_manager.egg-info\top_level.txt
writing webdriver_manager.egg-info\PKG-INFO
writing requirements to webdriver_manager.egg-info\requires.txt
writing manifest file 'webdriver_manager.egg-info\SOURCES.txt'
reading manifest file 'webdriver_manager.egg-info\SOURCES.txt'
writing manifest file 'webdriver_manager.egg-info\SOURCES.txt'
installing library code to build\bdist.java1.8.0_221\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\webdriver_manager
copying webdriver_manager\archive.py -> build\lib\webdriver_manager
copying webdriver_manager\chrome.py -> build\lib\webdriver_manager
copying webdriver_manager\driver.py -> build\lib\webdriver_manager
copying webdriver_manager\driver_cache.py -> build\lib\webdriver_manager
copying webdriver_manager\firefox.py -> build\lib\webdriver_manager
copying webdriver_manager\manager.py -> build\lib\webdriver_manager
copying webdriver_manager\microsoft.py -> build\lib\webdriver_manager
copying webdriver_manager\opera.py -> build\lib\webdriver_manager
copying webdriver_manager\utils.py -> build\lib\webdriver_manager
copying webdriver_manager_init_.py -> build\lib\webdriver_manager
creating build\bdist.java1.8.0_221
creating build\bdist.java1.8.0_221\egg
creating build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\archive.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\chrome.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\driver.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\driver_cache.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\firefox.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\manager.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\microsoft.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\opera.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager\utils.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
copying build\lib\webdriver_manager_init_.py -> build\bdist.java1.8.0_221\egg\webdriver_manager
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\archive.py to archive$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\chrome.py to chrome$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\driver.py to driver$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\driver_cache.py to driver_cache$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\firefox.py to firefox$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\manager.py to manager$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\microsoft.py to microsoft$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\opera.py to opera$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager\utils.py to utils$py.class
byte-compiling build\bdist.java1.8.0_221\egg\webdriver_manager_init_.py to init$py.class
creating build\bdist.java1.8.0_221\egg\EGG-INFO
copying webdriver_manager.egg-info\PKG-INFO -> build\bdist.java1.8.0_221\egg\EGG-INFO
copying webdriver_manager.egg-info\SOURCES.txt -> build\bdist.java1.8.0_221\egg\EGG-INFO
copying webdriver_manager.egg-info\dependency_links.txt -> build\bdist.java1.8.0_221\egg\EGG-INFO
copying webdriver_manager.egg-info\requires.txt -> build\bdist.java1.8.0_221\egg\EGG-INFO
copying webdriver_manager.egg-info\top_level.txt -> build\bdist.java1.8.0_221\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
Unable to analyze compiled code on this platform.
Please ask the author to include a 'zip_safe' setting (either True or False) in the package's setup.py
creating dist
creating 'dist\webdriver_manager-2.3.0-py2.7.egg' and adding 'build\bdist.java1.8.0_221\egg' to it
removing 'build\bdist.java1.8.0_221\egg' (and everything under it)
Processing webdriver_manager-2.3.0-py2.7.egg
creating c:\jython2.7.1\lib\site-packages\webdriver_manager-2.3.0-py2.7.egg
Extracting webdriver_manager-2.3.0-py2.7.egg to c:\jython2.7.1\lib\site-packages
Adding webdriver-manager 2.3.0 to easy-install.pth file

Installed c:\jython2.7.1\lib\site-packages\webdriver_manager-2.3.0-py2.7.egg
Processing dependencies for webdriver-manager==2.3.0
Searching for crayons
Reading https://pypi.python.org/simple/crayons/
Downloading https://files.pythonhosted.org/packages/ec/c9/8ade2831bfa5448f7e5b42f417bffe1269423893b435af556eb582356187/crayons-0.3.0.tar.gz#sha256=50e5fa729d313e2c607ae8bf7b53bb487652e10bd8e7a1e08c4bc8bf62755ffc
Best match: crayons 0.3.0
Processing crayons-0.3.0.tar.gz
Writing C:\Users\kgurupra\Documents\MobaXterm\slash\tmp\easy_install-zrw8js\crayons-0.3.0\setup.cfg
Running crayons-0.3.0\setup.py -q bdist_egg --dist-dir C:\Users\kgurupra\Documents\MobaXterm\slash\tmp\easy_install-zrw8js\crayons-0.3.0\egg-dist-tmp-qhk6fk
zip_safe flag not set; analyzing archive contents...
Unable to analyze compiled code on this platform.
Please ask the author to include a 'zip_safe' setting (either True or False) in the package's setup.py
creating c:\jython2.7.1\lib\site-packages\crayons-0.3.0-py2.7.egg
Extracting crayons-0.3.0-py2.7.egg to c:\jython2.7.1\lib\site-packages
Traceback (most recent call last):
File "setup.py", line 16, in
setuptools.setup(
File "C:\jython2.7.1\Lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\jython2.7.1\Lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\jython2.7.1\Lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\jython2.7.1\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\install.py", line 67, in run
self.do_egg_install()
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\install.py", line 117, in do_egg_install
cmd.run()
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 410, in run
self.easy_install(spec, not self.no_deps)
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 646, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 697, in install_item
self.process_distribution(spec, dist, deps)
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 741, in process_distribution
distros = WorkingSet([]).resolve(
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 741, in process_distribution
distros = WorkingSet([]).resolve(
File "C:\jython2.7.1\Lib\site-packages\pkg_resources_init_.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "C:\jython2.7.1\Lib\site-packages\pkg_resources_init_.py", line 1122, in best_match
return self.obtain(req, installer)
File "C:\jython2.7.1\Lib\site-packages\pkg_resources_init_.py", line 1134, in obtain
return installer(requirement)
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 669, in easy_install
rmtree(tmpdir)
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 2227, in rmtree
return shutil.rmtree(path, ignore_errors, onerror)
File "C:\jython2.7.1\Lib\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "C:\jython2.7.1\Lib\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "C:\jython2.7.1\Lib\shutil.py", line 252, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "C:\jython2.7.1\Lib\site-packages\setuptools\command\easy_install.py", line 1677, in auto_chmod
six.reraise(et, (ev[0], ev[1] + (" %s %s" % (func, arg))))
IndexError: index out of range: 1

──────────────────────────────────────────────────────────────────────────────

Edge driver binary is download as a zip file instead of .exe

The edge driver binary is being downloaded in a zip format instead of .exe

image

Digging into the code base, the below snippet causes the issue. The Microsoft API no longer provides the header response 'content-disposition', so, this logic needs re-visiting.

def _get_filename_from_response(self, response, driver):
        try:
            return re.findall("filename=(.+)",
                              response.headers["content-disposition"])[0]
        except IndexError:
            return "{}.zip".format(driver.name)
        except KeyError:
            return driver.name + ".exe"

Since, the cache look up is unable to find the binary (.exe) file in the ${USER_HOME}/.wdm, it downloads the driver each and every time ruining the purpose of cache.

Win 32 Bit Versions of Drivers Downloaded for Win 64

I am using the webdriver manager on a windows 10 64 bit machine and each time i attempt to use the webdriver manager, it downloads 32 bit versions of the drivers. However, when i execute the code utils.os_type() I can see win64 returned.

proxy

Guys,
Is it possible to use it behind a proxy server?
Thanks,
Mark

Wrong os_type params in many manager constructors

I found wrong values are assigned to the os_type in the firefox.py, microsoft.py and phantomjs.py manager constructors:
def __init__(self, version=None, os_type=utils.os_name()):

Contrary to this in the chrome.py the manager constructor looks like:
def __init__(self, version=None, os_type=utils.os_type()):

I think the os_type is the right choice, for example the geckodriver always downloads the 32 bit driver even in 64 bit environment.

Fix WSL

(venv) aolko@DESKTOP-?:/mnt/e/~py-proj/scrapr$ python3 app.py --chrome-auto
Initializing webdriver...

Checking for linux64 DESKTOP-?:2.46 in cache
There is no cached driver. Downloading new one...
Trying to download new driver from http://chromedriver.storage.googleapis.com/2.46/DESKTOP-?_linux64.zip
ValueError: There is no such driver DESKTOP-? with version 2.46 by http://chromedriver.storage.googleapis.com/2.46/DESKTOP-?_linux64.zip

maybe don't grab hostname/machine name?

FirefoxDriver - API rate limit exceeded for xx.xx

The self._latest_release_url does not contains GH_TOKEN

    def get_latest_release_version(self):
        # type: () -> str
        resp = requests.get(self._latest_release_url)
resp = <Response [403]>

    def validate_response(resp):
        if resp.status_code == 404:
            raise ValueError("There is no such driver by url {}".format(resp.url))
        elif resp.status_code != 200:
>           raise ValueError(resp.json())
E           ValueError: {'message': "API rate limit exceeded for xx.xx.xx.xx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", 'documentation_url': 'https://developer.github.com/v3/#rate-limiting'}

myenv/lib/python3.7/site-packages/webdriver_manager/utils.py:42: ValueError

Inside docker container driver manager do not use config.ini file and always download latest driver version

I use docker for running test.

Create folder .wdm in $HOME directory. 
$HOME in my case  = /root
copy to $HOME/.wdm config.ini file. (result path /root/.wdm) 
Run test 
Will be downloaded latest driver anyway.

But same flow locally work perfect for Windows and MacOS system.
Do you have some idea where can be problem?
Script output even when config.ini file is same folder and point to v0.20.1 version

Checking for linux64 geckodriver:v0.21.0 in cache
There is no cached driver. Downloading new one...
Getting latest mozila release info for v0.21.0
Trying to download new driver from https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz
Unpack archive /root/.wdm/geckodriver/v0.21.0/linux64/geckodriver-v0.21.0-linux64.tar.gz

ValueError: There is no such driver phantomjs with version 2.1.2 by https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.2-windows.zip

There is a problem getting the PhantonJSDriver. I traced it down to the driver_tags_url json @ https://api.github.com/repos/ariya/phantomjs/tags having a newer version of the drivers than exist on the download site.

Just realized that you can explicitly declare the version.. that fixes things. In-case someone else has this problem..

driver = webdriver.PhantomJS(executable_path=PhantomJsDriverManager(version='2.1.1').install())

Driver manager cant download driver when use xdist plugin for pytest

In case if we run tests in two or more threads produce error pythonOSError: [Errno 17] File exists: '/root/.wdm/chromedriver/2.41/linux64'
Reproduce only in docker containers based on ubuntu 16.04.
Reproduce time to time.

d = webdriver.Chrome(executable_path=ChromeDriverManager().install(),
/usr/local/lib/python2.7/dist-packages/webdriver_manager/chrome.py:19: in install
    bin_file = self._file_manager.download_driver(self.driver, path)
/usr/local/lib/python2.7/dist-packages/webdriver_manager/cache.py:73: in download_driver
    zip_file = self._download_file(driver, path)
/usr/local/lib/python2.7/dist-packages/webdriver_manager/cache.py:105: in _download_file
    self.create_cache_dir(driver_path)
/usr/local/lib/python2.7/dist-packages/webdriver_manager/cache.py:26: in create_cache_dir
    os.makedirs(driver_path)```
name = '/root/.wdm/chromedriver/2.41/linux64', mode = 511

    def makedirs(name, mode=0777):
        """makedirs(path [, mode=0777])
    
        Super-mkdir; create a leaf directory and all intermediate ones.
        Works like mkdir, except that any intermediate path segment (not
        just the rightmost) will be created if it does not exist.  This is
        recursive.
    
        """
        head, tail = path.split(name)
        if not tail:
            head, tail = path.split(head)
        if head and tail and not path.exists(head):
            try:
                makedirs(head, mode)
            except OSError, e:
                # be happy if someone already created the path
                if e.errno != errno.EEXIST:
                    raise
            if tail == curdir:           # xxx/newdir/. exists if xxx/newdir exists
                return
>       mkdir(name, mode)
E       OSError: [Errno 17] File exists: '/root/.wdm/chromedriver/2.41/linux64'

Connection error

Hi,
When running test sometimes I got connection error as below
ConnectionError: HTTPConnectionPool(host='chromedriver.storage.googleapis.com', port=80): Max retries exceeded with url: /LATEST_RELEASE (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7dcf609f28>: Failed to establish a new connection: [Errno 110] Connection timed out',))

Kind regards,
Frank

Specify version for driver

Hello,
By default, webdriver_manager will download the latest version of drivers. Can we specify the version of drivers to use?
Kind regards,
Frank

Running test in remote

Hi,
Can we manage the binary to register to remote grid? Something like this in Java
public class RegisterChrome {

public static void main(String[] args) throws Exception {
    ChromeDriverManager.getInstance().setup();
    GridLauncherV3.main(new String[] { "-role", "node", "-hub",
            "http://localhost:4444/grid/register", "-browser",
            "browserName=chrome,version=59", "-port", "5555" });
}

}
Kind regards,
Frank

Can you put the opera driver or/and microsoft edge canary chronium based browser

Hello,

I was trying to download the chrome driver, but the website cdn is down and i need a browser that can have chrome based extension and opera and new edge based on chromium browser support those extension


Checking for linux64 PCNAME:<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 502 (Server Error)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>502.</b> <ins>That’s an error.</ins>
  <p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That’s all we know.</ins> in cache
There is no cached driver. Downloading new one...
Trying to download new driver from http://chromedriver.storage.googleapis.com/<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 502 (Server Error)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>502.</b> <ins>That’s an error.</ins>
  <p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That’s all we know.</ins>/PCNAME_linux64.zip

other driver
opera driver
edge driver

if you don't have the time a can make a pull request
My fork with the addition of the opera and other small fix based on other issue

Thank !

Not able to fetch specified version of edge driver

local_driver = webdriver.Edge(EdgeDriverManager(version='3.14393').install())
Not able to fetch specified edge driver version(3.14393).

Version Details---
webdriver_manager==1.6.0
Selenium == 3.11
Python == 2.7

Release 1.8 fails with Chromium

With the 1.8 release a version check is run using google-chrome --version. This fails if Chromium is installed instead of Google Chrome (as the google-chrome binary is missing).

In 1.7 Chromium works. As a work around one can link chromium-browser to google-chrome:

ln -s /usr/bin/chromium-browser /usr/bin/google-chrome

So apart from this check, webdriver_manager seems to be perfectly fine with using Chromium instead of Google Chrome.

Option to silent "checking" message

Is there anyway I can silent the checking message? i.e.:
Checking for linux64 chromedriver:76.0.3809.126 in cache
Driver found in [path]/chromedriver

It floods my log.

Thanks!

Check for driver latest version once a day

Here is an idea.

What?

Cache not only binary of the driver but the latest version number as well. And update this number, let's say once a day.

Why?

How frequently drivers are updated? Not very much.
But we waste time on each test run for requesting the latest version from the internet.
Such caching can speed up testing.

Add cache for driver versions

As drivers released not so frequently we may cache driver latest driver version somehow in a file and then not ping GitHub or other services for every test run while the cache is valid.

Example cache.json

{
  "geckodriver": {
      "valid_period": "24hours"
      "date": "09/09/2019"
       "latest_version": "77.0.0456"
   }
}

Custom driver path installation does not work for chrome in 2.0.0

Today I got webdriver-manager upgraded to 2.0.0 from 1.8
I am using statement

driverLoc = "C:\Webdriver"
DriverPath = ChromeDriverManager().install(driverLoc)

Driver path returned "C:\Webdriver"but actual webdriver installed to c:\users\my_username.wdm...
Rolling back to 1.8 for now...

API rate limit exceeded for 49.248.27.50

Getting the following exception
File "/root/PycharmProjects/vnx_prequisite/venv/lib/python3.6/site-packages/webdriver_manager/firefox.py", line 18, in install
return self._file_manager.download_driver(self.driver, path).path
File "/root/PycharmProjects/vnx_prequisite/venv/lib/python3.6/site-packages/webdriver_manager/cache.py", line 70, in download_driver
cached_binary = self.get_cached_binary(driver, path)
File "/root/PycharmProjects/vnx_prequisite/venv/lib/python3.6/site-packages/webdriver_manager/cache.py", line 38, in get_cached_binary
version = driver.get_version()
File "/root/PycharmProjects/vnx_prequisite/venv/lib/python3.6/site-packages/webdriver_manager/driver.py", line 34, in get_version
return self.get_latest_release_version()
File "/root/PycharmProjects/vnx_prequisite/venv/lib/python3.6/site-packages/webdriver_manager/driver.py", line 61, in get_latest_release_version
validate_response(self, resp)
File "/root/PycharmProjects/vnx_prequisite/venv/lib/python3.6/site-packages/webdriver_manager/utils.py", line 40, in validate_response
raise ValueError(resp.json())
ValueError: {'message': "API rate limit exceeded for 49.248.27.50. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", 'documentation_url': 'https://developer.github.com/v3/#rate-limiting'}

Initial Update

Hi 👊

This is my first visit to this fine repo, but it seems you have been working hard to keep all dependencies updated so far.

Once you have closed this issue, I'll create separate pull requests for every update as soon as I find one.

That's it for now!

Happy merging! 🤖

Typo in README

Section for PhantomJS has an typo

driver = webdriver.PhantomJS(PhantomJsDriverDriverManager().install())

should be

driver = webdriver.PhantomJS(PhantomJsDriverManager().install())

return the path of driver

Very good api, I think it should set the driver path in window, I have not seen. I think need create a function to return the path, not install function, type executable_path = GeckoDriverManager().path(), this is very good function.

Just a question

How do you handle permission denied errors when trying to run this on Windows? Firefox, Edge, and IE are all running into similar issues. Windows 10.

Unable to download the latest IE Driver

The version name is getting formed incorrectly (.11.1 instead of 3.11.1)

line 144 in driver.py;
return latest_release[-9:-4]

should be [-10:-4] or the logic needs to change


Checking for x64 IEDriverServer:.11.1 in cache

There is no cached driver. Downloading new one...
Trying to download new driver from http://selenium-release.storage.googleapis.com/.11/IEDriverServer_x64_.11.1.zip
Traceback (most recent call last):
File "C:/PycharmProjects/LearningSelenium/try1.py", line 14, in
driver = webdriver.Ie(executable_path=IEDriverManager().install())
File "C:\PycharmProjects\SeleniumAgain\VirtualEnv3.6.0\lib\site-packages\webdriver_manager\microsoft.py", line 25, in install
return self._file_manager.download_driver(self.driver, path).path
File "C:\PycharmProjects\SeleniumAgain\VirtualEnv3.6.0\lib\site-packages\webdriver_manager\cache.py", line 73, in download_driver
zip_file = self._download_file(driver, path)
File "C:\PycharmProjects\SeleniumAgain\VirtualEnv3.6.0\lib\site-packages\webdriver_manager\cache.py", line 95, in _download_file
driver.name, driver.get_version(), driver.get_url()))
ValueError: There is no such driver IEDriverServer with version .11.1 by http://selenium-release.storage.googleapis.com/.11/IEDriverServer_x64_.11.1.zip

Process finished with exit code 1

Running 32-bit Python on x64 Windows identifies the OS architecture incorrectly

Hi Sergey,

To identify the OS bitness you've used platform.architecture() call, but it returns an architecture of Python itself. Rather than the OS.
Cases when I have 32-bit Python on Win64 machines:

  1. After the recent release a 64-bit version of Python 3.6 for Windows was not installable for a while;
    In stdout when running the webdriver_manager:
...
Checking for win32 geckodriver:v0.19.1 in cache   # Win32 version got downloaded.

Python cli:

>>> platform.architecture()
('32bit', 'WindowsPE')
>>> platform.machine()
'AMD64'
  1. I run Conda virtual environments on another Win10.
    In stdout when running the webdriver_manager:
...
Checking for win geckodriver:v0.19.1 in cache   # Win32 version got downloaded.

Note the architecture is just 'win' for some reason.
Though in Python cli:

>>> platform.architecture()
('64bit', 'WindowsPE')
>>> platform.machine()
'AMD64'

It seems like platform.machine() call returns more relevant data. But there likely are some other possible options.

I'm here to answer any other questions one might have.

Cannot download PhantomJS

I'm trying to run a test suite using phantomJS via webdriver_manager, and it seems to be looking for a version that doesn't exist

I call the driver manager like this:

driver = webdriver.PhantomJS(PhantomJsDriverManager().install())

And the error is

  File "/Users/lucas/Projects/sample/venv/lib/python3.6/site-packages/webdriver_manager/phantomjs.py", line 20, in install
    zip_file = self._file_manager._download_file(self.driver)
  File "/Users/lucas/Projects/sample/venv/lib/python3.6/site-packages/webdriver_manager/cache.py", line 83, in _download_file
    driver.name, driver.get_version(), driver.get_url()))
ValueError: There is no such driver phantomjs with version 2.1.2 by https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.2-macosx.zip

I've downloaded the latest version of phantomJS and placed it into the drivers folder as a workaround.

Error when fetching gecko driver on Mac OSX

I get the following error when fetching gecko driver

Checking for mac64 geckodriver:v0.19.1 in cache
There is no cached driver. Downloading new one...
Getting latest mozila release info for v0.19.1
Exception IndexError: list index out of range

No Python 2.7 Support

Hi,

I think it would be worth mentioning the fact that webdriver_manager only supports python 3.
os.makedirs() doesnt know what to do with the 'exist_ok' parameter before python 3.2

Cheers

NotADirectory Error When Running Firefox On Windows Box

I am trying to get CBT setup on a Windows box.
When I try to run Firefox, I am getting the following error:

NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\myusername\\.wdm\\geckodriver\\v0.24\\win64\\geckodriver.exe

The code we are trying to run, which runs successfully on a Mac is:

    def __init__(self, browser: str = TESTING_BROWSER, home: str = BASE_URL):
        """Hooray for inits."""
        if browser.lower() == "ie":
            webdriver.Ie.__init__(self, IEDriverManager().install())
        elif browser.lower() == 'edge':
            webdriver.Edge().__init__(self, EdgeDriverManager().install())
        elif browser.lower() == "firefox":
            webdriver.Firefox.__init__(self, executable_path=GeckoDriverManager().install())
        else:
            chrome_options = Options()
            if os.environ.get('RUN_HEADLESS') == 'True':
                chrome_options.add_argument('--headless')
                chrome_options.add_argument("--disable-extensions")
                chrome_options.add_argument("--disable-gpu")
                webdriver.Chrome.__init__(self, ChromeDriverManager().install(), chrome_options=chrome_options)
            else:
                webdriver.Chrome.__init__(self, ChromeDriverManager().install())

AWS Lambda Python Error - "Could not get version for Chrome with this command: google-chrome --version"

I'm trying to deploy a python web scraper with webdriver_manager on AWS Lambda. The scraper works fine on my laptop and within my main python 3.7 folder. However, when I zip the webdriver manager files, my lambda function, and all other necessary packages and files, and upload to Lambda, I get the following error - "Could not get version for Chrome with this command: google-chrome --version" - when the program tries to execute webdriver.Chrome(...) command. Here is the code I used:

chrome_options = Options() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-extensions') chrome_options.add_argument('--ignore-certificate-errors') browser = webdriver.Chrome(executable_path=ChromeDriverManager().install(), chrome_options=chrome_options)

NotADirectoryError on EC2 running amazon linux

geckodriver is downloaded automatically and the path is correct. But I'm getting NotADirectoryError on '/home/ec2-user/.wdm/geckodriver/v0.25.0/linux64/geckodriver'.
But after checking, I'm sure '/home/ec2-user/.wdm/geckodriver/v0.25.0/linux64/geckodriver'
is a file and executable (-rwxr-xr-x).

Calling this form python 3.7.4:
driver = webdriver.Firefox(GeckoDriverManager().install(),firefox_options=fireFoxOptions)

Result in:
Checking for linux64 geckodriver:v0.25.0 in cache
Driver found in /home/ec2-user/.wdm/geckodriver/v0.25.0/linux64/geckodriver
Traceback (most recent call last):
File "", line 1, in
File "/home/ec2-user/.pyenv/versions/3.7.4/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 147, in init
firefox_profile = FirefoxProfile(firefox_profile)
File "/home/ec2-user/.pyenv/versions/3.7.4/lib/python3.7/site-packages/selenium/webdriver/firefox/firefox_profile.py", line 78, in init
ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
File "/home/ec2-user/.pyenv/versions/3.7.4/lib/python3.7/shutil.py", line 318, in copytree
names = os.listdir(src)
NotADirectoryError: [Errno 20] Not a directory: '/home/ec2-user/.wdm/geckodriver/v0.25.0/linux64/geckodriver'

Doesn't seem to work when compiled with pyinstaller.

[Problem]
webdriver_manager is not downloading the correct driver due to config problems after it has been compiled down from pyinstaller.

Runs fine with Python 3.7 when running normally. After compiling with Pyinstaller, the result is the output is complaining about the config file missing values.
[TEST CODE]

from selenium.webdriver import Chrome
from webdriver_manager.chrome import ChromeDriverManager

browser = Chrome(executable_path=ChromeDriverManager().install())

[Results - Running from python]

Checking for win32 chromedriver:2.46 in cache
There is no cached driver. Downloading new one...
Trying to download new driver from http://chromedriver.storage.googleapis.com/2.46/chromedriver_win32.zip
Unpack archive C:\Users\LordRah\.wdm\chromedriver\2.46\win32\chromedriver.zip

Process finished with exit code 0

Working as intended.

Now lets compile this down with pyinstaller and run it.

[Results - Running from compiled exe - pyinstaller]
WITHOUT CONFIG INFO

Traceback (most recent call last):
  File "src\test.py", line 4, in <module>
  File "site-packages\webdriver_manager\chrome.py", line 15, in __init__
  File "site-packages\webdriver_manager\driver.py", line 45, in __init__
  File "site-packages\webdriver_manager\driver.py", line 18, in __init__
  File "site-packages\webdriver_manager\config.py", line 28, in __getattr__
  File "site-packages\webdriver_manager\config.py", line 21, in get
  File "configparser.py", line 780, in get
  File "configparser.py", line 1146, in _unify_values
configparser.NoSectionError: No section: 'ChromeDriver'
[9700] Failed to execute script test

[Quick-Fix Solution]
Ooops looks like we need the config.ini file created in the .wdm folder.
Add some info about what driver to download in the ini file and it will then work.

[ChromeDriver]
version = latest
name = chromedriver
driver_path = C:/Users/Admin/.wdm/chromedriver
url = https://chromedriver.storage.googleapis.com
offline = False
driver_latest_release_url = https://chromedriver.storage.googleapis.com/LATEST_RELEASE

[Results - Running from compiled exe - pyinstaller]
WITH CONFIG INFO

Checking for win32 chromedriver:73.0.3683.68 in cache
There is no cached driver. Downloading new one...
Trying to download new driver from https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_win32.zip
Unpack archive C:\Users\LordRah\.wdm\chromedriver\73.0.3683.68\win32\chromedriver.zip

DevTools listening on ws://127.0.0.1:55067/devtools/browser/de0f5d8d-ca18-482e-9e0f-1973c7d8d4ec

I am not sure how to solve it really as i haven't looked much into the problem, but it could be some permissions issue. In any case i hope this can be fixed soon!

Flatten module structure

Hi,
I wanted to suggest flattening the file structure by moving the various driver types into a single file. This way when looking to import multiple driver types there is less code to be written. I'm happy to raise a PR for this but thought I'd quickly check whether there was a specific reason you had implemented it in this way?

chrome_win64

When used on win64 PC it tries to download win64 version of chromedriver that just doesn't exists)

We've fixed on our side by adding
if os_type == "win64": os_type = "win32"
to chrome.py.

Definitely should be fixed in main rep as well)

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.