Webdrivermanager doesn't run the latest chrome driver version on linux
When I run my tests locally chrome driver manager prints 'Starting ChromeDriver 86.0.4240.22' but when the tests run on aws in linux server it prints 'Starting ChromeDriver 85.0.4183.87'. Why it happens? How can make the tests run with chromedriver 86?
See also questions close to this topic
-
Can not find file that is in resource folder - java
I have a question regarding file handling. I automate a page using selenium, and I need to upload a file in this page. I want to put the file in resource folder and read it's path in the test (since many OS and path will be different to any computer WIN/MAC).
I put the file manually in the resource folder, and it put it in:
X:\Project_11_01_2021\src\test\resources
when I used the ClassLoader and try to find the file it not found it, I saw that if I manually put it in this path it find it, found.
X:\Project_11_01_2021\out\test\resources
the problem is that I am using git and if I add to the resources it upload to git and every one will get the change, and when I put in out\test\resources it is not displayed in the source tree to commit to git. is their a way that classLoader will search in the first location? and not in the second?
[
][path that worked]
[
][when here not worked]
/******* test *******/
public void entertax() throws Exception { WebDriver deiver2 = getWebDriver(); Thread.sleep(1000); ClassLoader classLoader = getClass().getClassLoader(); String path = classLoader.getResource("TAX12.pdf").getPath(); System.out.println("\n\n path is " + path); deiver2.switchTo() .activeElement(); deiver2.findElement(By.xpath("//input[@type='file']")) .sendKeys( "X:\\Project_11_01_2021\\out\\test\\resources\\fw8TAX12.pdf"); System.out.println("END"); }
-
Can not get file path from resource folder - Java
I try to automate a page that I have. In the page I need to upload a PDF file. The problem is that I want selenium via java will get the file from the resource of the project and not hard coded. (since some have windows and some mac and some ubonto so the solution is to get the path dynamically).
I manually hard coded I enter the path it worked and return the path, however to let java return the path it crash. this is my code:
/******* test *******/ public void testFileUpload() throws Exception { WebDriver deiver2 = getWebDriver(); Thread.sleep(3000); deiver2.switchTo() .activeElement(); deiver2.findElement(By.xpath("//input[@type='file']")) .sendKeys( "X:\\project\\src\\test\\resources\\TAX12.pdf"); ClassLoader classLoader = getClass().getClassLoader(); String path = classLoader.getResource("TAX12.pdf").getPath(); System.out.println("\n\n path is " + path); System.out.println("END"); }
I want in the send keys to send the file, the exists however it is not worked. get null exception
the file exists in the folder and worked if manually set the path, but not locate the file if I want it to do it by himself (for win / mac / linux etc)
-
Can not get file path from resource folder - Java (exception)
I try to automate a page that I have. In the page I need to upload a PDF file. The problem is that I want selenium via java will get the file from the resource of the project and not hard coded. (since some have windows and some mac and some ubonto so the solution is to get the path dynamically).
I manually hard coded I enter the path it worked and return the path, however to let java return the path it crash. this is my code:
/******* test *******/ public void testFileUpload() throws Exception { WebDriver deiver2 = getWebDriver(); Thread.sleep(3000); deiver2.switchTo() .activeElement(); deiver2.findElement(By.xpath("//input[@type='file']")) .sendKeys( "X:\\project\\src\\test\\resources\\TAX12.pdf"); ClassLoader classLoader = getClass().getClassLoader(); String path = classLoader.getResource("TAX12.pdf").getPath(); System.out.println("\n\n path is " + path); System.out.println("END"); }
I want in the send keys to send the file, the exists however it is not worked.
java.lang.NullPointerException at org.testng.Assert.fail(Assert.java:97) at tests.ExPubPaymentPageTest.tryFile(ExPubPaymentPageTest.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134) at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:597) at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173) at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46) at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816) at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128) at java.util.ArrayList.forEach(ArrayList.java:1259) at org.testng.TestRunner.privateRun(TestRunner.java:766) at org.testng.TestRunner.run(TestRunner.java:587) at org.testng.SuiteRunner.runTest(SuiteRunner.java:384) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337) at org.testng.SuiteRunner.run(SuiteRunner.java:286) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187) at org.testng.TestNG.runSuitesLocally(TestNG.java:1109) at org.testng.TestNG.runSuites(TestNG.java:1039) at org.testng.TestNG.run(TestNG.java:1007) at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66) at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
the file exists in the folder and worked if manually set the path, but not locate the file if I want it to do it by himself (for win / mac / linux etc)
-
webdriver-manager and chromedriver breaks protractor test on MacOS
Background: I have a protractor testing bed on macOS 10.15.3 on a 2018 Mac mini with Intel Core i5 and it's been used to test a reactjs application with a nightly Jenkins pipeline. It's been running for months. On Jan-6-2021 evening, the test started failing with unknown system error as shown in log and screenshot below.
This problem has taken me and team hours to troubleshoot and figured that I will share my findings in case people who encounter the same issue can find a resolution without wasting time.
Error in the log spawn Unknown system error -86
2021-01-06 18:46:57.077 [18:46:56] I/launcher - Running 1 instances of WebDriver 2021-01-06 18:46:57.077 [18:46:56] I/direct - Using ChromeDriver directly... 2021-01-06 18:46:57.077 [18:46:56] E/launcher - spawn Unknown system error -86 2021-01-06 18:46:57.077 [18:46:56] E/launcher - Error: spawn Unknown system error -86
Cause Ever since Google starts including support for Mac M1 driver, webdriver-manager somehow treats the M1 driver as default on macOS regardless you have a x86 or M1 system.
Resolution
Upgrade webdriver-manager to 12.1.8: the webdriver-manager team reacted quickly and they have released a new version to address the issue as per https://github.com/angular/webdriver-manager/issues/476. In short, the issue will resolve itself after you upgrade webdriver-manager to 12.1.8. Make sure check your package.json, package-lock.json and update them if necessary.
In case you cannot upgrade webdriver-manager for whatever reason, simply replace M1 driver with x86 driver. It will work until you can upgrade webdriver-manager. You can find the chromedriver download at https://chromedriver.storage.googleapis.com/
2021-01-06 18:46:50.948 > protractor-jasmine@0.1.0 webdriver-update /Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor 2021-01-06 18:46:50.948 > webdriver-manager update --standalone=false --gecko=false 2021-01-06 18:46:50.948 2021-01-06 18:46:51.210 [18:46:51] I/file_manager - creating folder /Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/protractor/node_modules/webdriver-manager/selenium 2021-01-06 18:46:51.210 [18:46:51] I/config_source - curl -o/Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/protractor/node_modules/webdriver-manager/selenium/chrome-response.xml https://chromedriver.storage.googleapis.com/ 2021-01-06 18:46:51.776 [18:46:51] I/downloader - curl -o/Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_87.0.4280.88.zip https://chromedriver.storage.googleapis.com/87.0.4280.88/chromedriver_mac64_m1.zip 2021-01-06 18:46:52.349 [18:46:52] I/update - chromedriver: unzipping chromedriver_87.0.4280.88.zip 2021-01-06 18:46:52.610 [18:46:52] I/update - chromedriver: setting permissions to 0755 for /Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_87.0.4280.88 2021-01-06 18:46:52.611 [INFO] complete - installing protractor 2021-01-06 18:46:52.611 [INFO] Executing Protractor Test 2021-01-06 18:46:52.870 2021-01-06 18:46:52.870 > protractor-jasmine@0.1.0 e2e:jenkins /Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor 2021-01-06 18:46:52.870 > cross-env NODE_ENV=jenkins protractor protractor-entry.js "--suite" "workspace" 2021-01-06 18:46:52.870 2021-01-06 18:46:57.077 [18:46:56] I/launcher - Running 1 instances of WebDriver 2021-01-06 18:46:57.077 [18:46:56] I/direct - Using ChromeDriver directly... 2021-01-06 18:46:57.077 [18:46:56] E/launcher - spawn Unknown system error -86 2021-01-06 18:46:57.077 [18:46:56] E/launcher - Error: spawn Unknown system error -86 2021-01-06 18:46:57.078 at ChildProcess.spawn (internal/child_process.js:407:11) 2021-01-06 18:46:57.078 at Object.spawn (child_process.js:548:9) 2021-01-06 18:46:57.078 at exec (/Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/selenium-webdriver/io/exec.js:116:27) 2021-01-06 18:46:57.078 at /Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/selenium-webdriver/remote/index.js:219:25 2021-01-06 18:46:57.078 at processTicksAndRejections (internal/process/task_queues.js:97:5) 2021-01-06 18:46:57.078 From: Task: WebDriver.createSession() 2021-01-06 18:46:57.078 at Function.createSession (/Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/selenium-webdriver/lib/webdriver.js:769:24) 2021-01-06 18:46:57.078 at Function.createSession (/Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/selenium-webdriver/chrome.js:761:15) 2021-01-06 18:46:57.078 at Direct.getNewDriver (/Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/protractor/built/driverProviders/direct.js:77:33) 2021-01-06 18:46:57.078 at Runner.createBrowser (/Users/****/jenkins_home/codelabci001/workspace/devops-dev-e2e/develop_branch/client-protractor/node_modules/protractor/built/runner.js:195:43)
-
How can I download Appropriate Chromedriver in Protractor using Webdriver-Manager
I have designed a cucumber-protractor based automation framework where everything is working fine except for the Webdriver-manager. I need to update the binaries manually each time the IT Department updates google chrome version.
When i use command
"webdriver-manager update --proxy=http://someproxy.com:PORT#"
, webdriver-manager always downloads the latest chromdriver binaries instead of a compatible version as per the current Chrome Version.Please help me if there is a way to determine the chrome version automatically and download the corresponding Chrome binaries.
I have tried to search for similar behavior and forums elsewhere but none of the commands work. Instead it always downloads the latest version of chromedriver binaries instead of a compatible one.
Please help with some sample code in-case you come through a solution to this.
-
Error using webdriver-manager with pyinstaller
My webdriver-manager worked perfectly but when I made .exe file with pyinstaller I got error below. I find out that if I won't put --noconsole to pyinstaller command it will work but with --noconsole the program isn't working. Here is my code:
from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get("https://www.google.com/") driver.quit()
Here is how I created .exe file with pyinstaller:
pyinstaller --onefile --noconsole script.py
Here is the error which I got:
Traceback (most recent call last): File "script.py", line 797, in program2 File "webdriver_manager\chrome.py", line 23, in __init__ File "webdriver_manager\driver.py", line 54, in __init__ File "webdriver_manager\utils.py", line 139, in chrome_version File "os.py", line 983, in popen File "subprocess.py", line 804, in __init__ File "subprocess.py", line 1142, in _get_handles OSError: [WinError 6] The handle is invalid
Thanks for help!
-
WebDriverManager Throwing an exception
I am new to the JAVA + Selenium. I am using JAVa version 14x and selenium 3.141.x.
I came across WebDriverManager dependency which eliminates tedious task of maintaining browserDriver when our browsers' versions are upgraded. I a small selenium script to launch Chrome browser with the Help of WebDriverManager. However, it is not working and throwing an exception. Please details of error. Can someone please help me where I ma going wrong with this?
PS: Browser is launched if I uncomment row #12; and comment #13
WebDriverManager Maven Dependency
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager --> <dependency> <groupId>io.github.bonigarcia</groupId> <artifactId>webdrivermanager</artifactId> <version>4.2.2</version> </dependency>
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.String org.apache.commons.io.IOUtils.toString(java.io.InputStream, java.nio.charset.Charset)' at io.github.bonigarcia.wdm.versions.Shell.runAndWaitNoLog(Shell.java:66) at io.github.bonigarcia.wdm.versions.Shell.runAndWaitArray(Shell.java:55) at io.github.bonigarcia.wdm.versions.Shell.runAndWait(Shell.java:49) at io.github.bonigarcia.wdm.versions.VersionDetector.getBrowserVersionInWindows(VersionDetector.java:220) at io.github.bonigarcia.wdm.versions.VersionDetector.getDefaultBrowserVersion(VersionDetector.java:180) at io.github.bonigarcia.wdm.managers.ChromeDriverManager.getBrowserVersionFromTheShell(ChromeDriverManager.java:124) at io.github.bonigarcia.wdm.WebDriverManager.detectBrowserVersion(WebDriverManager.java:718) at io.github.bonigarcia.wdm.WebDriverManager.resolveDriverVersion(WebDriverManager.java:591) at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:543) at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:287) at Academy.Temp.main(Temp.java:20)
-
io.github.bonigarcia.wdm.config.webdrivermanager exception java.net.unknownhostexception chromedriver.storage.google
I am getting the below error on trying to launch a chrome browser using WebDriverManager.
io.github.bonigarcia.wdm.config.webdrivermanager exception java.net.unknownhostexception chromedriver.storage.google
Note: This issue I am getting on my company's network. This works fine on my local PC.
Please someone help me to resolve this issue. Thanks in Advance!!
-
I get this error at mid of test case when I use WebdriverManager with selenium in parallel. 'disconnected: not connected to DevTools'
disconnected: not connected to DevTools (Session info: chrome=87.0.4280.88) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'C02YM263JHD2', ip: 'fe80:0:0:0:14d0:b87a:ad38:1e24%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '11.0.8' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 87.0.4280.88, chrome: {chromedriverVersion: 87.0.4280.88 (89e2380a3e36c..., userDataDir: /var/folders/pl/yttsdh650jz...}, goog:chromeOptions: {debuggerAddress: localhost:50055}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} Session ID: 13a5db82b5b94c7a17fa75b28040b97e