Selenium远程配置问题

时间:2017-11-01 07:46:55

标签: testing selenium-webdriver automated-tests tdd selenium-chromedriver

我得到了这个。错误而不理解缺失的部分。

在点头和镀铬机上安装了镀铬 https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver

  

使用Chrome驱动程序进行测试

     

消息:测试方法SeleniumGridSmokeTest.UnitTest1.TestMethod1扔了   exception:System.InvalidOperationException:无法创建新的   服务:ChromeDriverService构建信息:版本:' 3.6.0',修订版:   ' 6fbf3ec767',时间:' 2017-09-27T16:15:40.131Z'系统信息:主持人:   ' seleniumnode',ip:' 10.0.0.9',os.name:' Linux',os.arch:' amd64',   os.version:' 4.4.0-97-generic',java.version:' 1.8.0_151'司机信息:   driver.version:unknown(InsecureCertificate)

     

使用Firefox驱动程序进行测试

     

[5:18]消息:测试方法   SeleniumGridSmokeTest.UnitTest1.TestMethod1抛出异常:   System.InvalidOperationException:无法创建新服务:   GeckoDriverService构建信息:版本:' 3.6.0',修订版:   ' 6fbf3ec767',时间:' 2017-09-27T16:15:40.131Z'系统信息:主持人:   ' seleniumnode',ip:' 10.0.0.9',os.name:' Linux',os.arch:' amd64',   os.version:' 4.4.0-97-generic',java.version:' 1.8.0_151'司机信息:   driver.version:unknown(InsecureCertificate)

这些是我创建selenium远程服务器的步骤。

A.我在谷歌云中创建了2个ubuntu框。 **

  • 一个用于服务器
  • 一个用于节点

B.将java安装到两台机器上(经过检查的java版本) http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/

C.Downloaded Selenium-server-standalone-3.6.0.jar wget" http://selenium-release.storage.googleapis.com/3.6/selenium-server-standalone-3.6.0.jar" D.运行枢纽命令 java -jar Selenium-server-standalone-3.6.0.jar -role hub

E.运行节点命令

java -Dwebdriver.chrome.driver = chromedriver.exe -jar selenium-server-standalone-3.6.0.jar -role node -hub http://xxxxxx:4444/grid/register

D.Saw控制台的屏幕 enter image description here

配置信息

browserTimeout:0 debug:false 帮助:假 港口:5555 角色:节点 超时:1800 enablePassThrough:true cleanUpCycle:5000 主持人:10.0.0.9 maxSession:5 功能:功能[{seleniumProtocol = WebDriver,browserName = chrome,maxInstances = 5,platform = LINUX}] 功能:功能[{seleniumProtocol = WebDriver,browserName = firefox,maxInstances = 5,platform = LINUX}] 功能:功能[{seleniumProtocol = WebDriver,browserName = internet explorer,maxInstances = 1,platform = LINUX}] downPollingLimit:2 枢纽:http://51.141.24.51:4444/grid/register id:http://10.0.0.9:5555 hubHost:51.141.24.51 hubPort:4444 nodePolling:5000 nodeStatusCheckTimeout:5000 proxy:org.openqa.grid.selenium.proxy.DefaultRemoteProxy 注册:真的 registerCycle:5000 remoteHost:http://10.0.0.9:5555 unregisterIfStillDownAfter:60000

致电代码 enter image description here

这些是我的应用程序中的包 enter image description here

HUB LOG

  

2017-11-01 17:00:17.120:INFO:osjs.Server:main:已启动@ 985ms   17:00:17.121信息 - 节点应注册到   http://10.0.0.8:4444/grid/register/ 17:00:17.121 INFO - Selenium Grid   集线器已启动并运行17:08:48.736 INFO - 已注册节点   http://10.0.0.9:5555 17:15:14.628信息 - 收到创建新请求的请求   session:Capabilities [{browserName = chrome,platformName = ANY,   version =,platform = ANY}] 17:15:14.628 INFO - 尝试创建一个新的   测试槽上的会话{seleniumProtocol = WebDriver,browserName = chrome,   maxInstances = 5,platform = LINUX} 17:17:47.972 INFO - 得到了请求   创建一个新会话:Capabilities [{acceptInsecureCerts = true,   browserName = firefox}] 17:17:47.973 INFO - 尝试创建一个新的   测试槽上的会话{seleniumProtocol = WebDriver,browserName = firefox,   maxInstances = 5,platform = LINUX} 17:18:15.651 INFO - 有请求   创建一个新会话:Capabilities [{acceptInsecureCerts = true,   browserName = firefox}] 17:18:15.651 INFO - 尝试创建一个新的   测试槽上的会话{seleniumProtocol = WebDriver,browserName = firefox,   maxInstances = 5,platform = LINUX}

NODE LOG

  

17:17:48.015 INFO - 能力{acceptInsecureCerts = true,   browserName = firefox,}匹配的类   org.openqa.selenium.remote.server.ServicedSession $ Factory(提供者:   org.openqa.selenium.firefox.GeckoDriverService)17:17:48.015 INFO -   功能{acceptInsecureCerts = true,browserName = firefox,}匹配   class org.openqa.selenium.remote.server.ServicedSession $ Factory   (提供者:org.openqa.selenium.chrome.ChromeDriverService)   17:18:15.649 INFO - 将默认提供程序绑定到:   org.openqa.selenium.chrome.ChromeDriverService 17:18:15.650 INFO -   找到处理程序   org.openqa.selenium.remote.server.commandhandler.BeginSession@77bf54a0   17:18:15.650 INFO - / session:在/ session上执行POST(处理程序:   BeginSession)17:18:15.651 INFO - 能力是:能力   {acceptInsecureCerts = true,browserName = firefox,} 17:18:15.651 INFO -   功能{acceptInsecureCerts = true,browserName = firefox,}匹配   class org.openqa.selenium.remote.server.ServicedSession $ Factory   (提供者:org.openqa.selenium.firefox.GeckoDriverService)   17:18:15.652 INFO - 功能{acceptInsecureCerts = true,   browserName = firefox,}匹配的类   org.openqa.selenium.remote.server.ServicedSession $ Factory(提供者:   org.openqa.selenium.chrome.ChromeDriverService)

     

19:50:39.179 INFO - Selenium构建信息:版本:' 3.6.0',修订版:   ' 6fbf3ec767' 19:50:39.179 INFO - 启动Selenium Grid节点   2017-11-01 19:50:39.577:INFO :: main:记录初始化@ 627ms到   org.seleniumhq.jetty9.util.log.StdErrLog 19:50:39.633 INFO - Driver   找不到类:com.opera.core.systems.OperaDriver 19:50:39.654 INFO    - 跳过驱动程序提供程序类org.openqa.selenium.ie.InternetExplorerDriver注册:注册功能   [{ensureCleanSession = true,browserName = internet explorer,version =,   platform = WINDOWS}]与当前平台LINUX不匹配   19:50:39.654 INFO - 驱动程序提供程序类   跳过org.openqa.selenium.edge.EdgeDriver注册:   注册功能[{browserName = MicrosoftEdge,   version =,platform = WINDOWS}]与当前平台LINUX不匹配   19:50:39.655 INFO - 驱动程序提供程序类   跳过org.openqa.selenium.safari.SafariDriver注册:   注册能力[{browserName = safari,version =,   platform = MAC}]与当前平台LINUX 19:50:39.673不匹配   信息 - 使用直通模式处理程序2017-11-01   19:50:39.693:INFO:osjs.Server:main:jetty-9.4.5.v20170502 2017-11-01   19:50:39.713:WARN:osjs.SecurityHandler:主要:   ServletContext的@ o.s.j.s.ServletContextHandler @ 595b007d {/,空开始}   已发现路径的http方法:/ 2017-11-01   19:50:39.722:INFO:osjsh.ContextHandler:main:已启动   o.s.j.s.ServletContextHandler@595b007d {/,NULL,AVAILABLE}

启动中心后

  

xxx @ seleniumhub:〜$ java -jar selenium-server-standalone-3.6.0.jar   -role hub 18:19:41.659 INFO - Selenium构建信息:版本:' 3.6.0',修订版:' 6fbf3ec767' 18:19:41.660 INFO - 启动Selenium Grid hub   2017-11-01 18:19:42.217:INFO :: main:记录初始化@ 772ms到   org.seleniumhq.jetty9.util.log.StdErrLog 18:19:42.230 INFO - Will   听听4444 2017-11-01 18:19:42.277:INFO:osjs.Server:main:   jetty-9.4.5.v20170502 2017-11-01 18:19:42.313:INFO:osjs.session:main:   DefaultSessionIdManager workerName = node0 2017-11-01   18:19:42.313:INFO:osjs.session:main:没有SessionScavenger设置,使用   默认值2017-11-01 18:19:42.315:INFO:osjs.session:main:清理   每600000ms 2017-11-01 18:19:42.323:INFO:osjsh.ContextHandler:main:   开始o.s.j.s.ServletContextHandler@1ad282e0 {/,null,AVAILABLE}   2017-11-01 18:19:42.354:INFO:osjs.AbstractConnector:main:已开始   ServerConnector @ 1efee8e7 {HTTP / 1.1,[http / 1.1]} {0.0.0.0:4444} 2017-11-01   18:19:42.355:INFO:osjs.Server:main:已开始@ 910ms 18:19:42.356信息 -   节点应注册到http://10.0.0.8:4444/grid/register/   18:19:42.356 INFO - Selenium Grid hub已启动并正在运行

1 个答案:

答案 0 :(得分:-1)

在您的代码中,您使用了 Google Chrome 作为浏览器,该浏览器由 chromedriver.exe 初始化。

因此,在启动 Selenium Grid Node 时,我们必须添加 chromedriver.exe 的参数,如下所示:

java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.6.0.jar -role node -hub http://localhost:4444/grid/register