webdrivermanager是否支持RemoteWebDriver(Selenium Grid)?

时间:2017-06-16 08:04:51

标签: webdrivermanager-java

我在pom.xml文件中更新了WebDrivermanager的依赖项。 虽然在下面运行我的本地代码似乎工作正常。

driver = new ChromeDriver(capability);

但是当我尝试使用RemoteWebDriver远程运行代码时,它失败并继续要求为浏览器添加二进制文件

URL remote_grid = new URL("http://" + seleniumHub + ":" + seleniumHubPort + "/wd/hub");
driver = new RemoteWebDriver(remote_grid, capability);

它抛出异常。

[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

1 个答案:

答案 0 :(得分:1)

实际上,WebDriverManager可以帮助设置Selenium Grid。这个过程如下:

  1. 启动中心。您可以使用命令行( public class BinarySearchTree { DoubleLinkedList dL; TreeNode root; public BinarySearchTree() { this.root = null; this.dL=new DoubleLinkedList(); } public void tree2DList(TreeNode TN) { if (TN == null) { return ; } else { tree2DList(TN.left); dL.insertLast((YourClassOfObjects)TN.getItem()); tree2DList(TN.right); } return; } )来完成此操作,也可以使用此https://angular.io/guide/forms#track-control-state-and-validity-with-ngmodel中的Java类。
  2. 在集线器中注册节点。这是WebDriverManager帮助的地方,因为它下载了正确的二进制文件,用该二进制文件注册节点。在这里,您可以使用Chrome浏览器找到example
  3. 运行测试,连接到URL的中心。这是另一个example