Is webdrivermanager supporting RemoteWebDriver (Selenium Grid)?
Asked Answered
F

1

2

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
Foam answered 16/6, 2017 at 8:4 Comment(0)
B
8

In fact WebDriverManager can help with the setup of Selenium Grid. The process would be as follows:

  1. 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.
  2. Run your test, connecting to the URL's hub. Here another example.
Bacciferous answered 18/6, 2017 at 18:53 Comment(2)
The answer is very sound, but the second link is broken. Would you mind researching when you get the chance?Clot
@user662913 FixedRadiophotograph

© 2022 - 2024 — McMap. All rights reserved.