Closed ithjz closed 6 years ago
Hi @ithjz Have you tried using seleniumbase install chromedriver
? It doesn't seem to be on your path.
Additionally, get the new seleniumbase version 1.15.8 to take care of those deprecation warnings you see, which are related to the version of python used. Also, add a "--upgrade" to your pip install to make sure you have the latest versions of python packages being used: pip install -r requirements.txt --upgrade
@ithjz Now, v1.15.10 should take care of the remaining DeprecationWarnings you saw (https://github.com/seleniumbase/SeleniumBase/pull/209/files), which updated methods that use regular expressions to pass raw strings. Use pip install -U seleniumbase --no-cache-dir
to reinstall from pypi, (Or pip install -U -i https://pypi.anaconda.org/seleniumbase/simple seleniumbase
if you're using Anaconda Cloud). Then get chromedriver into your seleniumbase drivers folder with seleniumbase install chromedriver
.
I haven't heard back in 4 days, so I'll assume this issue is resolved. Please update to the latest version of seleniumbase if you haven't already.
(In case someone else runs into this.) I was seeing the same issue under Windows Server.
seleniumbase install chromedriver
Worked fine, no errors, but seleniumbase would die with "cannot find Chrome Binary".
For some reason, I HAD to use seleniumbase install chromedriver latest.
As soon as I did that, everything worked fine.
** install **
Usage:
seleniumbase install [DRIVER_NAME] [OPTIONS]
(Drivers: chromedriver, geckodriver, edgedriver,
iedriver, operadriver)
Options:
VERSION Specify the version.
(Default chromedriver version = 2.44)
Use "latest" for the latest version.
-p OR --path Also copy the driver to /usr/local/bin
It would be cool to specify custom path!
@bukowa It can always be copied to another location, but these are the safe paths to use. There could be permissions issues, etc, when using other paths. The only time that the seleniumbase/drivers
folder isn't good enough is when using a Selenium Grid - that requires the driver to be on the system path. Otherwise, it's safer to use seleniumbase/drivers
because then you could have a different version of the browser driver for different virtual environments. If the system path is used, all users would have to use the same driver.
(venv) (⎈|N/A:default)➜ tests git:(new2) ✗ seleniumbase install chromedriver latest
*** chromedriver version for download = 107.0.5304.62 (Latest)
Downloading chromedriver_linux64.zip from:
https://chromedriver.storage.googleapis.com/107.0.5304.62/chromedriver_linux64.zip ...
Download Complete!
Extracting ['chromedriver'] from chromedriver_linux64.zip ...
Unzip Complete!
The file [chromedriver] was saved to:
/home/buk/Git/k8s-wp/venv/lib/python3.10/site-packages/seleniumbase/drivers/chromedriver
Making [chromedriver 107.0.5304.62] executable ...
[chromedriver 107.0.5304.62] is now ready for use!
(venv) (⎈|N/A:default)➜ tests git:(new2) ✗ pytest .
(Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or hide this info with --headless, or by calling the new --headless2.)
==================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.10.6, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/buk/Git/k8s-wp/tests
plugins: html-2.0.1, metadata-2.0.4, xdist-3.0.2, forked-1.4.0, rerunfailures-10.2, seleniumbase-4.8.2, ordering-0.6
collected 1 item
basic_test.py
FAILED basic_test.py::MyTestClass::test_basics - selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
I wonder why it still doesn't work out of the box with venv :/
It works with firefox seleniumbase install geckodriver
pytest --headed --browser=firefox
@bukowa cannot find Chrome binary
means that Chrome wasn't found on your machine. Chrome must be installed separately. (SeleniumBase only downloads the drivers for you.)
@bukowa
cannot find Chrome binary
means that Chrome wasn't found on your machine. Chrome must be installed separately. (SeleniumBase only downloads the drivers for you.)
Oh ok thank you
I've found a better way to handle the current situation:
Download a relatively new driver, such as:
Place this driver in path\to\Lib\site-packages\seleniumbase\drivers
. It might be a virtual environment, so adjust accordingly
Then it can be run.
e:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandle r.py:242: WebDriverException
During handling of the above exception, another exception occurred: ..\seleniumbase\fixtures\base_case.py:3085: in setUp switch_to=True) ..\seleniumbase\fixtures\base_case.py:2496: in get_new_driver proxy_string=proxy_string) ..\seleniumbase\core\browser_launcher.py:161: in get_driver return get_local_driver(browser_name, headless, proxy_string) ..\seleniumbase\core\browser_launcher.py:342: in get_local_driver return webdriver.Chrome(executable_path=LOCAL_CHROMEDRIVER) e:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\chrome\webdriver.p y:75: in init desired_capabilities=desired_capabilities) e:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.p y:156: in init self.start_session(capabilities, browser_profile) e:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.p y:251: in start_session response = self.execute(Command.NEW_SESSION, parameters) e:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.p y:320: in execute self.error_handler.check_response(response)
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x00000000 04F34EF0> response = {'sessionId': '7f07e0ad8bb1dbd36eb27c3283d5a58d', 'status': 13, 'valu e': {'message': 'unknown error: cannot find Chrom...r info: chromedriver=2.40.56 5498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 6.1.7601 SP1 x86_64)'}}
r.
onary object.
e:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandle r.py:242: WebDriverException ============================== warnings summary =============================== source:1067: DeprecationWarning: invalid escape sequence \S source:1168: DeprecationWarning: invalid escape sequence \S source:1289: DeprecationWarning: invalid escape sequence \S source:131: DeprecationWarning: invalid escape sequence \d source:141: DeprecationWarning: invalid escape sequence \d source:358: DeprecationWarning: invalid escape sequence _ source:374: DeprecationWarning: invalid escape sequence _ source:625: DeprecationWarning: invalid escape sequence * source:649: DeprecationWarning: invalid escape sequence *
-- Docs: https://docs.pytest.org/en/latest/warnings.html ==================== 1 failed, 9 warnings in 8.33 seconds =====================
E:\users\administrator\eclipse-workspace2\SeleniumBase-master\examples>