I've updated the dependency for the WebDrivermanager in my pom.xml file.
while running the code in my local like below it seems working fine.
driver = new ChromeDriver(capability);
but when I tried to run the code Remotely with RemoteWebDriver, it failed and keep asking to add binaries for browsers
URL remote_grid = new URL("http://" + seleniumHub + ":" + seleniumHubPort + "/wd/hub");
driver = new RemoteWebDriver(remote_grid, capability);
It throws below exception.
[Invoker 1386767190] Keeping method SeleniumInit.setUp(java.lang.reflect.Method, org.testng.ITestContext)[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5] for class [TestClass name=class com.wo2.commonfucntion.index.LoginIndex]
[Invoker 1386767190] Keeping method SeleniumInit.tearDown(org.testng.ITestResult)[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5] for class [TestClass name=class com.wo2.commonfucntion.index.LoginIndex]
[Invoker 1386767190] Keeping method SeleniumInit.setUp(java.lang.reflect.Method, org.testng.ITestContext)[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5] for class [TestClass name=class com.wo2.commonfucntion.index.LoginIndex]
[Invoker 1386767190] Invoking #BeforeMethod SeleniumInit.setUp(java.lang.reflect.Method, org.testng.ITestContext)[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5]
13:27:40.503 [main] INFO i.g.bonigarcia.wdm.BrowserManager - Reading https://chromedriver.storage.googleapis.com/ to seek [chromedriver]
13:27:41.358 [main] INFO i.g.bonigarcia.wdm.BrowserManager - Latest version of [chromedriver] is 2.30
13:27:41.368 [main] DEBUG io.github.bonigarcia.wdm.Downloader - Using binary driver previously downloaded C:\Users\zara\.m2\repository\webdriver\chromedriver\win32\2.30\chromedriver.exe
13:27:41.368 [main] INFO i.g.bonigarcia.wdm.BrowserManager - Exporting webdriver.chrome.driver as C:\Users\zara\.m2\repository\webdriver\chromedriver\win32\2.30\chromedriver.exe
========= Google Chrome Browser ==========
Failed to invoke configuration method com.wo2.init.SeleniumInit.setUp:The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
Command duration or timeout: 120 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'ICWS-1162', ip: '192.168.0.42', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
Driver info: driver.version: RemoteWebDriver
[Invoker 1386767190] Keeping method SeleniumInit.tearDown(org.testng.ITestResult)[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5] for class [TestClass name=class com.wo2.commonfucntion.index.LoginIndex]
[Invoker 1386767190] Invoking #AfterMethod SeleniumInit.tearDown(org.testng.ITestResult)[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5]
TEST FAILED - validLogin
ERROR MESSAGE: null
message from tear downjava.lang.NullPointerException
===== Invoked methods
SeleniumInit.fetchSuiteConfiguration(org.testng.ITestContext)[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5]org.testng.TestRunner#485e36bc 1501587365
LoginIndex.validLogin()[pri:0, instance:com.wo2.commonfucntion.index.LoginIndex#598067a5] 1501587365
=====
Creating D:\Rahul_P-QA\Intech_Workspace\WO2_QA\WO2_QA\test-output\Work Order - 2\WO2_SC_001 _ To verify user can login successfully..html
Creating D:\Rahul_P-QA\Intech_Workspace\WO2_QA\WO2_QA\test-output\Work Order - 2\WO2_SC_001 _ To verify user can login successfully..xml
FAILED CONFIGURATION: #BeforeMethod setUp(public void com.wo2.commonfucntion.index.LoginIndex.validLogin(), org.testng.TestRunner#485e36bc)
org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
Command duration or timeout: 120 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'ICWS-1162', ip: '192.168.0.42', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
Driver info: driver.version: RemoteWebDriver
In fact WebDriverManager can help with the setup of Selenium Grid. The process would be as follows:
Start hub and nodes. You can do it using the command line (java -jar selenium-server-standalone-<version>.jar standalone), or use a Java class with the help of WebDriverManager to download the proper drivers. Here you can find an example using Chrome and Firefox as browsers.
Run your test, connecting to the URL's hub. Here another example.
Related
After starting a chrome driver in java a SessionNotCreatedException is thrown by the application.
This is the code:
System.setProperty("webdriver.chrome.driver", "D:\\Development\\Driver\\chromedriver.exe");
WebDriver webDriver = new ChromeDriver();
webDriver.get("https://google.com");
The exception:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.0.0-beta-1', revision: '9c03156c2b'
System info: host: 'DESKTOP-S9O6TAK', ip: '192.168.0.211', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {desiredCapabilities=Capabilities {browserName: chrome}}]
Capabilities {}
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:252)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:174)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:82)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:99)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:86)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:41)
at de.antonbowe.fachecker.FAChecker.(FAChecker.java:57)
at de.antonbowe.fachecker.FAChecker.main(FAChecker.java:63)
Caused by: java.lang.NullPointerException
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:122)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:153)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:153)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 8 more
Process finished with exit code 1
I updated the chrome driver several times and tried other old projects. All dont work.
When I was using selenium-java version 4.0.0-beta-3 alone, it worked fine. But after I added the following additional dependencies to my project (per https://developers.google.com/gmail/api/quickstart/java), I got the same errors.
google-api-client 1.23.0
google-oauth-client-jetty 1.23.0
google-api-services-gmail v1-rev83-1.23.0
I downgraded my selenium-java to version 3.141.59. The error went away.
Code is working fine for chrome but for Edge I'm facing issue
I have set below properties in application.properties file
driver.name=edgeDriver
webdriver.edge.driver = drivers/msedgedriver.exe
I have also downloaded edgedriver.exe as per current version of my edge browser
Edge Version : Version 89.0.774.63
When I am trying to execute the test I am seeing below messages in console log
Unable to get class
com.qmetry.qaf.automation.step.client.TestStepExporter from jar
/C:/Users/piyush/.m2/repository/com/qmetry/qaf/3.0.0/qaf-3.0.0.jar
[QAFTestBase] - Initializing
Driver...browser_str:edgeDriver,base_url:https://qmetry.github.io/qaf/,sel_server:localhost,port:4444
[UiDriverFactory] - Driver: edgeDriver Mar 26, 2021 3:25:36 PM
org.openqa.selenium.remote.DesiredCapabilities edge INFO: Using new EdgeOptions() is preferred to DesiredCapabilities.edge()
Unable to create driver instance in 1st attempt with retry timeout of
30 seconds. You can check/set value of 'driver.init.retry.timeout'
appropriately to set retry timeout on driver initialization
failure.Unable to Create Driver Instance for edge:
java.lang.NoSuchMethodException:
org.openqa.selenium.edge.EdgeDriver.(java.net.URL,
org.openqa.selenium.Capabilities)
Build info: version: '3.141.59', revision: 'e82be7d358', time:
'2018-11-14T08:17:03'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version:
'10.0', java.version: '11.0.10'
Driver info: driver.version: unknown
Referred to how to use edgeDriver with qaf
it seems the property webdriver.edge.driver should be appended with "system" prefix. That means:
system.webdriver.edge.driver = drivers/msedgedriver.exe
After this, Page launched successfully
chrome driver 77
chrome version 77
Starting ChromeDriver 77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865#{#442}) on port 38929
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created
from disconnected: unable to send message to renderer
(Session info: chrome=77.0.3865.90)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'DESKTOP-JCFLT7B', ip: '192.168.1.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '10.0.2'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
Versions of driver and of Chrome should match.
In Chrome, disable autoupdates. Otherwise after launching Chrome will be updated and can became incompatible with Java driver.
i am setting up a selenium based testing application. I am using chrome driver for testing.
I have set up a docker image as in the below URL.
https://github.com/Leafney/alpine-selenium-chrome/blob/master/Dockerfile
I have configured the chrome driver property as follows.
System.setProperty("webdriver.chrome.driver", "/usr/lib/chromium/chromedriver");
However, I get the below error informing that chrome failed to start.
Command duration or timeout: 60.07 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'c34db8dbfca2', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.27-moby', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
unknown error: Chrome failed to start: crashed
Any pointers on this will be helpful.
I had the same issue with Chromedriver and Alpine, Chromedriver is not executable at all, even I had tried to install and run almost every version of the Chromedriver, no luck.
And then I had to use Debian Linux in order to execute Chromedriver properly for e2e testing in docker and CI.
Hi I apologise for a repost but I am new to selenium and tried to launch this simple command to open youtube in a google. However, it keeps crashing and showing this error. Directly below is the code I am running.
System.setProperty("webdriver.chrome.driver",
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
System.out.println(System.getProperty("webdriver.chrome.driver"));
WebDriver driver3 = new ChromeDriver();
driver3.get("https://www.youtube.com/");
Could anyone point me in the right direction of where I'm going wrong. Thank you
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Exception in thread "main"
org.openqa.selenium.remote.UnreachableBrowserException: Could not start
a new session. Possible causes are invalid address of the remote server
or browser start-up failure.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'nuigit450', ip: '192.168.16.22', os.name: 'Windows
7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:622)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:174)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:163)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:120)
at TestWeb.main(TestWeb.java:22)
Caused by: java.lang.IllegalStateException: The process has not exited yet therefore no result is available ...
at org.apache.commons.exec.DefaultExecuteResultHandler.getException(DefaultExecuteResultHandler.java:76)
at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:173)
at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:185)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:177)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
... 7 more
Your webdriver.chrome.driver point to Chrome browser but it should point to chromedriver. For reference: https://sites.google.com/a/chromium.org/chromedriver/getting-started
You need to download chromedriver from here: https://sites.google.com/a/chromium.org/chromedriver/downloads and set path to this file in webdriver.chrome.driver.