我按照以下步骤开始使用selenium hub。启动selenium grid hub
hub.json文件:
{
"port": 4441,
"newSessionWaitTimeout": -1,
"custom": {},
"capabilityMatcher":"org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"cleanUpCycle": 5000,
"role": "hub",
"debug": false,
"browserTimeout": 0,
"timeout": 1800
}
我解雇了命令:
java -Dwebdriver.chrome.driver=E:\SELENIUM_DOWNLOADS\Drivers\chromedriver.exe -jar E:\SELENIUM_DOWNLOADS\Jars\selenium-server-standalone-3.11.0.jar -role hub -hubConfig hub.json
结果:
E:\>cd \selenium_practice\Maven_Workspace\DataDriven_zoho_18April2019_GRID
E:\selenium_practice\Maven_Workspace\DataDriven_zoho_18April2019_GRID>java -Dwebdriver.chrome.driver=E:\SELENIUM_DOWNLOADS\Drivers\chromedriver.exe -jar E:\SELENIUM_DOWNLOADS\Jars\selenium-server-standalone-3.11.0.jar -role hub -hubConfig hub.json
00:40:48.652 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.11.0', revision: 'e59cfb3'
00:40:48.652 INFO [GridLauncherV3$2.launch] - Launching Selenium Grid hub on port 4441
2018-04-22 00:40:49.166:INFO::main: Logging initialized @1081ms to org.seleniumhq.jetty9.util.log.StdErrLog
00:40:49.572 INFO [Hub.start] - Selenium Grid hub is up and running
00:40:49.572 INFO [Hub.start] - Nodes should register to http://192.168.1.10:4441/grid/register/
00:40:49.572 INFO [Hub.start] - Clients should connect to http://192.168.1.10:4441/wd/hub
当我输入浏览器http://192.168.1.10:4441/grid/register/
时HTTP ERROR 500
Problem accessing /grid/register. Reason:
Server Error
Caused by: java.lang.IllegalStateException: Not a JSON Object: null
答案 0 :(得分:0)
通过自定义配置启动 Selenium Grid Hub 时,您需要考虑以下几点:
启动 Selenium Grid Hub 时,您可以删除参数 -Dwebdriver ,如下所示:
java -jar E:\SELENIUM_DOWNLOADS\Jars\selenium-server-standalone-3.11.0.jar -role hub -hubConfig hub.json
您需要通过网址访问 Selenium Grid Hub控制台:
http://localhost:4441/grid/console
要查看您需要访问网址的配置:
http://localhost:4441/grid/console?config=true&configDebug=true
根据 hub.json 文件 Selenium Grid Hub控制台配置的快照: