我使用nodejs selenium单机版,我有:
1)硒独立运行在Mac上的角色=集线器
2) selenium standalone在Mac上运行,角色=节点(在本地Mac浏览器上运行测试)
3) Windows 10安装在parallels desktop上,selenium standalone以role=node运行
4) 针对本文配置了IE11https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-配置
我有gridUrl配置在我的测试(yandex双子),当我把它设置为windows节点url(http://10.211.55.4:5555/wd/hub)IE11测试工作正常。但是当我将gridUrl设置为正确的值(意味着本地网格集线器127.0.0.1:4444/wd/hub)时,IE11会在控制台中的“这是WebDriver服务器的初始开始页”和“只允许本地连接”处打开。在这种情况下,所有其他的windows浏览器都可以正常工作(chrome,Firefox,edge)。在mac selenium网格集线器控制台或windows selenium节点控制台中没有任何错误-似乎网格集线器以某种方式错误地试图调用windows节点IEDriver。
启动selenium的命令:
1) MacOS中心:
java -jar 3.8.1-server.jar -role hub
2) Windows10节点:
java -jar 3.8.1-server.jar -role node -hub http://192.168.1.4:4444/grid/register
之后,我可以看到MacOS上的所有节点和浏览器http://127.0.0.1:4444/grid/console.
我使用selenium 3.8.1、IEdriver x64 3.8.0
MacOS集线器终端屏幕截图:
Windows节点cmd屏幕截图:
MacOS grid hub控制台屏幕截图及配置:
MacOS网格集线器控制台截图:
集线器和节点的DEBUG模式输出:
成功时Windows节点控制台输出(不使用网格集线器直接连接):
2018-01-21 22:07:43.348:INFO:osjshC.ROOT:qtp31280858-9: org.openqa.selenium.remote.server.WebDriverServlet-11d44a3: Initialising WebDriverServlet
22:07:43.379 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@1f51925
22:07:43.379 INFO - /session: Executing POST on /session (handler: BeginSession)
22:07:43.458 INFO - Capabilities are: Capabilities {browserName: internet explorer, javascriptEnabled: true, platform: WINDOWS, version: }
22:07:43.458 INFO - Capabilities {browserName: internet explorer, javascriptEnabled: true, platform: WINDOWS, version: } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.ie.InternetExplorerDriverService)
Started InternetExplorerDriver server (64-bit)
3.8.0.0
Listening on port 3512
Only local connections are allowed
22:07:43.770 DEBUG - CookieSpec selected: default
22:07:43.770 DEBUG - Auth cache not set in the context
22:07:45.551 INFO - Detected dialect: W3C
22:07:45.598 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:45.598 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/window/current/size (handler: ServicedSession)
22:07:45.770 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:45.770 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:45.833 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:45.833 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/moveto (handler: ServicedSession)
22:07:45.865 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:45.865 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/url (handler: ServicedSession)
22:07:46.428 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:46.428 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:46.489 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:46.489 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:46.552 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:46.552 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:46.615 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:46.615 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:47.208 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:47.208 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing GET on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/screenshot (handler: ServicedSession)
22:07:47.301 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:47.301 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:47.349 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:47.349 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing GET on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/screenshot (handler: ServicedSession)
22:07:47.520 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:47.520 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:47.599 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:47.599 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing GET on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/screenshot (handler: ServicedSession)
22:07:47.771 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:47.786 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing POST on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/execute (handler: ServicedSession)
22:07:47.833 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:47.833 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing GET on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f/screenshot (handler: ServicedSession)
22:07:48.567 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@c91496
22:07:48.567 INFO - Handler thread for session 7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (internet explorer): Executing DELETE on /session/7bfb0881-fcfb-48fc-8f6a-cdbdf7164a6f (handler: ServicedSession)
22:07:48.598 INFO - Removing session org.openqa.selenium.remote.server.ServicedSession@c91496
Windows节点控制台输出失败(通过mac网格集线器连接):
2018-01-21 22:14:36.612:INFO:osjshC.ROOT:qtp29933260-14: org.openqa.selenium.remote.server.WebDriverServlet-1474f18: Initialising WebDriverServlet
22:14:36.628 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@1f793e6
22:14:36.628 INFO - /session: Executing POST on /session (handler: BeginSession)
22:14:36.721 INFO - Capabilities are: Capabilities {browserName: internet explorer, javascriptEnabled: true, platform: WINDOWS, version: }
22:14:36.721 INFO - Capabilities {browserName: internet explorer, javascriptEnabled: true, platform: WINDOWS, version: } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.ie.InternetExplorerDriverService)
22:14:36.752 DEBUG - Waiting for [http://localhost:15388/status]
22:14:36.752 DEBUG - Polling http://localhost:15388/status
Started InternetExplorerDriver server (64-bit)
3.8.0.0
Listening on port 15388
Only local connections are allowed
22:14:37.269 DEBUG - Polling http://localhost:15388/status
22:14:37.269 DEBUG - sun.net.www.MessageHeader@14906bf5 pairs: {GET /status HTTP/1.1: null}{User-Agent: Java/1.8.0_161}{Host: localhost:15388}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
22:14:37.269 DEBUG - sun.net.www.MessageHeader@4b81f27 pairs: {null: HTTP/1.1 200 OK}{Content-Length: 185}{Content-Type: application/json; charset=UTF-8}{Cache-Control: no-cache}{Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept}{Accept-Ranges: bytes}{Connection: close}
22:14:37.283 DEBUG - CookieSpec selected: default
22:14:37.283 DEBUG - Auth cache not set in the context
22:14:37.283 DEBUG - Connection request: [route: {}->http://localhost:15388][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
22:14:37.283 DEBUG - Connection leased: [id: 2][route: {}->http://localhost:15388][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]
22:14:37.283 DEBUG - Opening connection {}->http://localhost:15388
22:14:37.283 DEBUG - Connecting to localhost/127.0.0.1:15388
22:14:37.283 DEBUG - Connection established 127.0.0.1:52058<->127.0.0.1:15388
22:14:37.283 DEBUG - http-outgoing-2: set socket timeout to 10800000
22:14:37.283 DEBUG - Executing request POST /session HTTP/1.1
22:14:37.283 DEBUG - Target auth state: UNCHALLENGED
22:14:37.283 DEBUG - Proxy auth state: UNCHALLENGED
22:14:37.283 DEBUG - http-outgoing-2 >> POST /session HTTP/1.1
22:14:37.283 DEBUG - http-outgoing-2 >> Content-Type: application/json; charset=utf-8
22:14:37.283 DEBUG - http-outgoing-2 >> Content-Length: 364
22:14:37.283 DEBUG - http-outgoing-2 >> Host: localhost:15388
22:14:37.283 DEBUG - http-outgoing-2 >> Connection: Keep-Alive
22:14:37.283 DEBUG - http-outgoing-2 >> User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_161)
22:14:37.283 DEBUG - http-outgoing-2 >> Accept-Encoding: gzip,deflate
22:14:37.283 DEBUG - http-outgoing-2 >> "POST /session HTTP/1.1[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "Content-Type: application/json; charset=utf-8[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "Content-Length: 364[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "Host: localhost:15388[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "Connection: Keep-Alive[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_161)[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "Accept-Encoding: gzip,deflate[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "[\r][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "{[\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> " "desiredCapabilities": {"browserName":"internet explorer","javascriptEnabled":true,"platform":"WINDOWS","version":""},[\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> " "capabilities": {[\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> " "desiredCapabilities": {"browserName":"internet explorer","javascriptEnabled":true,"platform":"WINDOWS","version":""},[\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> " "firstMatch": [[\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> " {"browserName":"internet explorer","platformName":"windows"}[\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> " ][\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> " }[\n]"
22:14:37.283 DEBUG - http-outgoing-2 >> "}"
22:14:38.833 DEBUG - http-outgoing-2 << "HTTP/1.1 200 OK[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "Content-Length: 692[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "Content-Type: application/json; charset=UTF-8[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "Cache-Control: no-cache[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "Accept-Ranges: bytes[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "Connection: close[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "{"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"internet explorer","browserVersion":"11","pageLoadStrategy":"normal","platformName":"windows","proxy":{},"se:ieOptions":{"browserAttachTimeout":0,"elementScrollBehavior":0,"enablePersistentHover":true,"ie.browserCommandLineSwitches":"","ie.ensureCleanSession":false,"ie.fileUploadDialogTimeout":3000,"ie.forceCreateProcessApi":false,"ignoreProtectedModeSettings":false,"ignoreZoomSetting":false,"initialBrowserUrl":"http://localhost:15388/","nativeEvents":true,"requireWindowFocus":false},"setWindowRect":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}},"sessionId":"3aba8a66-2b37-4516-b16c-b34acaea1555"}}[\n]"
22:14:38.833 DEBUG - http-outgoing-2 << "[\r][\n]"
22:14:38.833 DEBUG - http-outgoing-2 << HTTP/1.1 200 OK
22:14:38.833 DEBUG - http-outgoing-2 << Content-Length: 692
22:14:38.833 DEBUG - http-outgoing-2 << Content-Type: application/json; charset=UTF-8
22:14:38.833 DEBUG - http-outgoing-2 << Cache-Control: no-cache
22:14:38.833 DEBUG - http-outgoing-2 << Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
22:14:38.833 DEBUG - http-outgoing-2 << Accept-Ranges: bytes
22:14:38.833 DEBUG - http-outgoing-2 << Connection: close
22:14:38.833 DEBUG - http-outgoing-2: Close connection
22:14:38.833 DEBUG - Connection discarded
22:14:38.833 DEBUG - Connection released: [id: 2][route: {}->http://localhost:15388][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
22:14:38.848 INFO - Detected dialect: W3C
22:14:38.864 DEBUG - Executing: newSession [null, newSession {desiredCapabilities=Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: false, ignoreZoomSetting: false, initialBrowserUrl: http://localhost:15388/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}}]
22:14:38.864 DEBUG - Executed: [null, newSession {desiredCapabilities=Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: false, ignoreZoomSetting: false, initialBrowserUrl: http://localhost:15388/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}}]
22:14:40.676 DEBUG - CookieSpec selected: default
22:14:40.676 DEBUG - Auth cache not set in the context
我可以清楚地看到您的Selenium Grid Hub
配置和注册到Selenium Grid Hub
的Selenium Grid节点中存在一些不匹配,如下所示:
>
Nodes should register to http://10.37.129.2:4444/grid/register/
Selenium网格节点
日志显示:
Registering the node to the hub: http://192.168.1.4:4444/grid/register
此外,当您启动节点以使用
IEDriverServer
和Internet Explorer
时,但您使用的默认命令为:
java -jar 3.8.1-server.jar -role node -hub http://192.168.1.4:4444/grid/register
这就是你在失败的用例中看不到
INFO-检测方言: W3C
的确切原因,如下所示:
Started InternetExplorerDriver server (64-bit)
3.8.0.0
Listening on port 15388
Only local connections are allowed
22:14:37.269 DEBUG - Polling http://localhost:15388/status
22:14:37.269 DEBUG - sun.net.www.MessageHeader@14906bf5 pairs: {GET /status HTTP/1.1: null}{User-Agent: Java/1.8.0_161}{Host: localhost:15388}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
22:14:37.269 DEBUG - sun.net.www.MessageHeader@4b81f27 pairs: {null: HTTP/1.1 200 OK}{Content-Length: 185}{Content-Type: application/json; charset=UTF-8}{Cache-Control: no-cache}{Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept}{Accept-Ranges: bytes}{Connection: close}
22:14:37.283 DEBUG - CookieSpec selected: default
22:14:37.283 DEBUG - Auth cache not set in the context
其中,您需要提到您打算使用的
WebDriver
变体,如下所示:
java -Dwebdriver.ie.driver=IEDriverServer.exe -jar selenium-server-standalone-3.8.1.jar -role node -hub http://192.168.1.50:4444/grid/register
因此,您的日志消息将包含:
Started InternetExplorerDriver server (64-bit)
3.7.0.0
Listening on port 18597
Only local connections are allowed
20:31:59.237 INFO - Detected dialect: W3C
20:31:59.592 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@40024bf3
20:31:59.593 INFO - Handler thread for session b020db2b-f3db-43f6-a3db-7a21b8c440f7 (internet explorer): Executing POST on /session/b020db2b-f3db-43f6-a3db-7a21b8c440f7/url (handler: ServicedSession)
20:31:59.663 INFO - To upstream: {"url":"http://google.com/"}
您可以在这里看到Doug Simmons明确提到的详细讨论:
服务器(网格节点)需要使用系统属性启动,而不是客户端,即需要将节点指向节点上的geckodriver安装
按照上述步骤配置Selenium Grid Hub和Selenium Grid Node:
>
启动
Selenium网格中心
:
java -jar selenium-server-standalone-3.8.1.jar -role hub
应生成以下日志:
19:40:59.322 INFO - Selenium build info: version: '3.8.1', revision: '6e95a6684b'
19:40:59.324 INFO - Launching Selenium Grid hub
2018-01-23 19:41:01.710:INFO::main: Logging initialized @2960ms to org.seleniumhq.jetty9.util.log.StdErrLog
19:41:01.764 INFO - Will listen on 4444
2018-01-23 19:41:01.881:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2018-01-23 19:41:01.923:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2018-01-23 19:41:01.924:INFO:osjs.session:main: No SessionScavenger set, using defaults
2018-01-23 19:41:01.928:INFO:osjs.session:main: Scavenging every 600000ms
2018-01-23 19:41:01.937:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@1b68b9a4{/,null,AVAILABLE}
2018-01-23 19:41:01.959:INFO:osjs.AbstractConnector:main: Started ServerConnecto
r@157632c9{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-01-23 19:41:01.960:INFO:osjs.Server:main: Started @3211ms
19:41:01.960 INFO - Nodes should register to http://192.168.1.50:4444/grid/register/
19:41:01.961 INFO - Selenium Grid hub is up and running
观察
Selenium Grid Hub URI
is:http://192.168.1.50:4444
通过
URL
打开Selenium Grid Hub控制台:
http://192.168.1.50:4444/grid/console
Selenium网格中心配置1的快照:
Selenium网格集线器配置2的快照
>
启动
IE11的
Selenium网格节点
:
java -Dwebdriver.ie.driver=IEDriverServer.exe -jar selenium-server-standalone-3.8.1.jar -role node -hub http://192.168.1.50:4444/grid/register
确保
Selenium网格节点
已在注册http://192.168.1.50:4444/grid/register
以下日志应在
Selenium Grid Node
CLI上生成:
19:46:22.516 INFO - Selenium build info: version: '3.8.1', revision: '6e95a6684b'
19:46:22.517 INFO - Launching a Selenium Grid node
2018-01-23 19:46:25.124:INFO::main: Logging initialized @4715ms to org.seleniumhq.jetty9.util.log.StdErrLog
19:46:25.178 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
19:46:25.221 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
19:46:25.226 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
19:46:25.227 INFO - Driver class not found: com.opera.core.systems.OperaDriver
19:46:25.228 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
19:46:25.230 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
19:46:25.232 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
19:46:25.306 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities {browserName: safari, platform: MAC, version: } does not match the current platform WIN8
19:46:25.371 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
19:46:25.373 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
19:46:25.374 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
19:46:25.375 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
19:46:25.376 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
19:46:25.391 INFO - Using the passthrough mode handler
2018-01-23 19:46:25.429:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2018-01-23 19:46:25.472:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.S
ervletContextHandler@38afe297{/,null,STARTING} has uncovered http methods for path: /
2018-01-23 19:46:25.481:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@38afe297{/,null,AVAILABLE}
2018-01-23 19:46:25.503:INFO:osjs.AbstractConnector:main: Started ServerConnector@12bb9576{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
2018-01-23 19:46:25.504:INFO:osjs.Server:main: Started @5097ms
19:46:25.506 INFO - Selenium Grid node is up and ready to register to the hub
19:46:25.555 INFO - Starting auto registration thread. Will try to register every 5000 ms.
19:46:25.556 INFO - Registering the node to the hub: http://192.168.1.50:4444/grid/register
19:46:25.802 INFO - The node is registered to the hub and ready to use
应在
Selenium Grid Hub
CLI上生成以下日志:
20:59:54.695 INFO - Registered a node http://192.168.1.50:5555
Selenium网格中心控制台的快照
:
>
编写一个基本程序并从
Selenium Grid Node
执行:
public class test_IE_Grid
{
@Test
public void test1() throws MalformedURLException
{
System.setProperty("webdriver.ie.driver", "C:\\Utility\\BrowserDrivers\\IEDriverServer.exe");
DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
URL url = new URL("http://192.168.1.50:4444/wd/hub");
WebDriver driver = new RemoteWebDriver(url, cap);
driver.get("http://google.com/");
System.out.println("Title is : "+driver.getTitle());
driver.quit();
}
}
请在
Selenium Grid Node
CLI上观察以下日志:
2018-01-23 20:31:49.931:INFO:osjshC.ROOT:qtp1582071873-15: org.openqa.selenium.remote.server.WebDriverServlet-34123d65: Initialising WebDriverServlet
20:31:49.976 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@5769309d
20:31:49.990 INFO - /session: Executing POST on /session (handler: BeginSession)
20:31:50.085 INFO - Capabilities are: Capabilities {browserName: internet explorer, ensureCleanSession: true, platform: WINDOWS, version: }
20:31:50.089 INFO - Capabilities {browserName: internet explorer, ensureCleanSession: true, platform: WINDOWS, version: } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.ie.InternetExplorerDriverService)
Started InternetExplorerDriver server (64-bit)
3.7.0.0
Listening on port 18597
Only local connections are allowed
20:31:59.237 INFO - Detected dialect: W3C
20:31:59.592 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@40024bf3
20:31:59.593 INFO - Handler thread for session b020db2b-f3db-43f6-a3db-7a21b8c440f7 (internet explorer): Executing POST on /session/b020db2b-f3db-43f6-a3db-7a21b8c440f7/url (handler: ServicedSession)
20:31:59.663 INFO - To upstream: {"url":"http://google.com/"}
20:32:11.793 INFO - To downstream: {"value":null}
20:32:11.821 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@40024bf3
20:32:11.823 INFO - Handler thread for session b020db2b-f3db-43f6-a3db-7a21b8c440f7 (internet explorer): Executing GET on /session/b020db2b-f3db-43f6-a3db-7a21b8c440f7/title (handler: ServicedSession)
20:32:11.844 INFO - To downstream: {"value":"Google"}
20:32:11.856 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@40024bf3
20:32:11.857 INFO - Handler thread for session b020db2b-f3db-43f6-a3db-7a21b8c440f7 (internet explorer): Executing DELETE on /session/b020db2b-f3db-43f6-a3db-7a21b8c440f7 (handler: ServicedSession)
20:32:11.870 INFO - To downstream: {"value":null}
20:32:11.883 INFO - Removing session org.openqa.selenium.remote.server.ServicedSession@40024bf3
20:32:11.890 INFO - To downstream: { "value" : null }
请观察Selenium Grid Hub上的以下日志:
20:31:49.855 INFO - Got a request to create a new session: Capabilities {browserName: internet explorer, ensureCleanSession: true, platform: WINDOWS, version: }
20:31:49.866 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, se:CONFIG_UUID=dd5107be-46cc-4411-816e-e51177b854c6, browserName=internet explorer, maxInstances=1, platform=WINDOWS}
IDE控制台输出:
Jan 23, 2018 9:18:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Title is : Google
PASSED: test1
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================
我有一些关于硒网格的疑问。 考虑以下场景: 机器A:通过命令注册为集线器= 机器B:安装了Windows 7和chrome浏览器 通过命令注册为节点= 机器C:有Windows 7和Chrome浏览器 通过命令注册为节点= < code > Java-dwebdriver . chrome . driver = " chrome驱动程序的路径"-jar selenium-server-standa
问题内容: 我有两个运行Windows Server 2012的虚拟机。一个运行Jenkins,另一个运行Jenkins的构建作业之一。作业从Subversion中检出测试代码,然后在Windows批处理脚本中运行。该测试可以编译并运行,但是会失败,并显示。这些是使用Selenium和Firefox驱动程序的TestNG测试。 如果我使用完全相同的命令并从Windows命令行运行它,则测试成功。我
我想在Jenkins运行一个脚本10小时。这可能吗?我的脚本长度大约是55分钟。我现在已经安排它每小时运行一次。所以它保持每小时运行一次。(永不停止!!) 但是有没有办法让它在指定的时间内运行,比如说10个小时,然后自动停止?我希望它指定这个55分钟的脚本应该连续运行多长时间,然后自动停止,而不是安排。 所以,如果我在上午8点开始构建,并说运行3小时,它应该一直运行到上午11点,然后停止。
我的应用程序动态创建表,我不知道如何使用Spring jdbc读取表,而不将其硬编码到字符串查询中。我在想这样的事情: 但spring不喜欢问号:-( 谢谢你的帮助!
问题内容: 在Linux中,可以使用以下命令为网络数据包(例如UDP)指定系统的默认接收缓冲区大小: 但我想知道,应用程序(例如in中)是否可以通过在运行时指定每个UDP套接字的接收缓冲区大小来覆盖系统的默认值? 问题答案: 您可以从默认值增加该值,但不能将其增加到最大值以上。使用更改选项: 请注意,这是便携式解决方案。它可以在任何POSIX平台上工作,以增加接收缓冲区的大小。Linux已经进行了
问题内容: 我的程序包测试用例分散在多个文件中,如果运行,它将运行程序包中的所有测试用例。 虽然没有必要全部运行。有没有一种方法指定要运行的文件,使其仅运行文件中定义的测试用例? 问题答案: 有两种方法。一种简单的方法是使用该标志并提供与您要运行的测试名称匹配的模式。 例: 有关更多信息,请参阅文档。 另一种方法是命名包含您要运行的测试的特定文件: 但是有一个陷阱。如果满足以下条件,则效果很好: