Unable to create driver instance for Edge driver - java

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

Related

Selenium Webdriver Problem cannot open google chrome

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.

Unable to start Chrome Driver - Alpine Linux

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.

Web driver exception on robot framework tests on jenkins

I have robot framework tests that when run locally, run fine. But when run on jenkins, after a fixed number of tests(nearly 14), start giving exceptions.
WebDriverException: Message: Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'xxxx', ip: 'xxxx', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-327.10.1.el7.x86_64', java.version: '1.8.0_131'
Driver info: driver.version: unknown
Stacktrace:
What might be causing this? Do i need to breakdown big suites to smaller ones?
The error says it all :
WebDriverException: Message: Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'xxxx', ip: 'xxxx', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-327.10.1.el7.x86_64', java.version: '1.8.0_131'
Driver info: driver.version: unknown
The error clearly says the following :
Your Selenium Java Client details is not getting detected back as in revision: 'unknown', time: 'unknown'
Your WebDriver variant details is not getting detected back as in Driver info: driver.version: unknown
Your main issue is the version compatibility between the binaries you are using as follows :
Your Selenium Java Client version is 3.4.0 of Apr 21, 2017 which is almost a year older.
Your JDK version is 1.8.0_131 which is pretty ancient.
Your WebDriver variant version is unknown to us.
Your Web Client variant version is unknown to us.
So there is a clear mismatch between the JDK v8u131 , Selenium Client v2.4.0.
Solution
Upgrade JDK to recent levels JDK 8u162.
Upgrade Selenium to current levels Version 3.11.0.
Upgrade WebDriverDriver variant version to recent levels.
Upgrade Web Client version to recent levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client base version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Execute your #Test.

Is webdrivermanager supporting RemoteWebDriver (Selenium Grid)?

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.

Selenium getting error

This is my selenium test script.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class Adminlogin {
public static void main(String[] args) {
//File file = new File("C:/Selenium/IEDriverServer_x64_2.53.1/IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", "C:/Selenium/IEDriverServer_x64_2.53.1/IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
//driver.close(); //Closes the browser
}
}
I am getting this error,
Started InternetExplorerDriver server (64-bit)
2.53.1.0
Listening on port 35197
Only local connections are allowed
Oct 07, 2016 9:54:51 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Oct 07, 2016 9:54:52 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
Oct 07, 2016 9:54:52 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
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: 'c7b525d', time: '2016-09-01 14:52:30 -0700'
System info: host: 'user-PC', ip: '192.168.2.113', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_31'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:228)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:144)
at Sanitytests.Adminlogin.main(Adminlogin.java:13)
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}], required capabilities = null
Build info: version: 'unknown', revision: 'c7b525d', time: '2016-09-01 14:52:30 -0700'
System info: host: 'user-PC', ip: '192.168.2.113', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_31'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:597)
Well, I had a simmilar error, due to SessionNotCreatedException, caused by DesiredCapabilities discrepancy.
On further research, I went back to https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. In the "Required Configuration" section was my solution:
"Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog."
So, I went to Tools -> Internet Options -> Advanced Settings -> Security section.
Unchecked "Enable enhanced protected mode". Bingo!
I recommend you go through the "Required Configuration" section in the github link above. There might be other settings you need to apply.
I realized that IE browser capabilities had to be changed to support selenium. like zoom, protected mode, etc ...
try changing IE settings and it should work.

Categories