Introduction
Selenium Grid runs Selenium test remotely, the main idea is to run selenium in parallel on multiple machines
advantage
- It is the central entry point for all tests
- Can manage and control the Nodes/environment where the browser is running
- Expand
- Run tests in parallel
- Cross-platform testing
- Load balancing
composition
Installation and use
Environmental preparation:
- java environment
- Webdriver corresponding to the browser
download link:
https://www.selenium.dev/downloads/
Official documents:
https://github.com/SeleniumHQ/selenium/wiki/Grid2
Start selenium grid:
# 作为 hub 角色启动
java -jar selenium-server-standalone-<version>.jar -role hub
Configure node.json, this file can manage the distributed environment, the sample is as follows:
{
"capabilities":
[
{
"browserName": "firefox",
"marionette": true,
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "internet explorer",
"platform": "WINDOWS",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "safari",
"technologyPreview": false,
"platform": "MAC",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": -1,
"register": true,
"registerCycle": 5000,
"hub": "http://localhost:4444",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
Use the configuration file to run selenium grid:
java -jar selenium-server-standalone.jar -role node -nodeConfig nodeconfig.json
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。