利用chromedriver操作webview
1.创建chrome server
chromedriver --url-base=wd/hub --port=9515 --adb-port=5037
2.创建session
POST http://127.0.0.1:9515/wd/hub/session
参数:{"desiredCapabilities":{"chromeOptions":{"androidPackage":"包名(com.****.****)","androidUseRunningApp":true,"androidDeviceSerial":"设备号(192.168.56.101:5555)"}}}
正常返回值:{
"sessionId": "0e4152f98153bdd3441b6d0f706f408d",
"status": 0,
"value": {
"acceptSslCerts": true,
"applicationCacheEnabled": false,
"browserConnectionEnabled": false,
"browserName": "chrome",
"chrome": {},
"cssSelectorsEnabled": true,
"databaseEnabled": false,
"handlesAlerts": true,
"hasTouchScreen": true,
"javascriptEnabled": true,
"locationContextEnabled": true,
"mobileEmulationEnabled": false,
"nativeEvents": true,
"platform": "ANDROID",
"rotatable": false,
"takesHeapSnapshot": true,
"takesScreenshot": true,
"version": "44.0.2403.119",
"webStorageEnabled": true
}
}
3.通过http api操作
rest.get('/wd/hub/status', controller.getStatus);
rest.post('/wd/hub/session', controller.createSession);
rest.get('/wd/hub/session/:sessionId?', controller.getSession);
等等
网友评论