部署selenium hub与浏览器节点

1
2
3
4
# 部署selenium hub (java -jar selenium-server-standalone-3.141.59.jar -role hub)
docker run -d -p 4444:4444 --name hub -e GRID_TIMEOUT=0 -e GRID_THROW_ON_CAPABILITY_NOT_PRESENT-true -e GRID_NEW_SESSION_WAIT_TIMEOUT=-1 -e GRID_BROWSER_TIMEOUT=15000 -e GRID_TIMEOUT=30000 -e GRID_CLEAN_UP_CYCLE=30000 selenium/hub:3.141
# 部署node-chrome浏览器节点,debug模式可以通过VNC查看,密码secret(--link hub关联到hub,需同网段)
docker run -d -p 5900:5900 --name node -e NODE_MAX_INSTANCES=6 -e NODE_MAX_SESSION=6 -e NODE_REGISTER_CYCLE=5000 -e DBUS_SESSION_BUS_ADDRESS=/dev/null -v /dev/shm:/dev/shm --link hub selenium/node-chrome-debug:3.141

移动端接入

https://blog.csdn.net/chen072086/article/details/106503548?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 设备注册到hub
cd '/c/Program Files/Appium/resources/app/node_modules/appium/build/lib'
node main.js -a 127.0.0.1 -p 4723 -bp 4725 -U 8676-A01-0x3da2c286 --nodeconfig /d/bq/config/dason.json

#配置说明
{
"capabilities":
[
{
"deviceName": "127.0.0.1:62001", #此为adb devices检测到的设备名
"version":"4.4.2", #模拟器/真机的系统版本
"maxInstances": 1, #最多的实例个数
"platform":"ANDROID", #测试平台:Android
"browserName": "" #测试普通App可置为空,如果是测试浏览器如chrome就可以写上
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"hub":"127.0.0.1:4444/grid/register", #hub的注册接口地址
"url":"http://127.0.0.1:4723/wd/hub", #Appium Server的默认访问路径
"host": "127.0.0.1", #Appium Server的IP地址
"port": 4723, #Appium Server端口号
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444, #hub端口号
"hubHost": "127.0.0.1", #hub IP地址,这里是在本机上启动的,如果是在另外的机器上需要用其外部的IP地址,比如:192.168.1.111这种
"hubProtocol": "http" #协议,默认为http
}
}

#配置参考
{
"capabilities": [
{
"deviceName": "8676-A01-0x3da2c286",
"version": "5.1",
"maxInstances": 1,
"platform": "ANDROID",
"browserName": "chrome"
}
],
"configuration": {
"cleanUpCycle": 2000,
"timeout": 30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"hub": "http://192.168.0.108:4444/grid/register",
"url": "http://127.0.0.1:4723/wd/hub",
"host": "192.168.0.103",
"port": 4723,
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "192.168.0.108",
"hubProtocol": "http"
}
}