添加参数 newCommandTimeout 相当于保活吧 。
def andriod_driver(device_id, port):
desired_caps = {
'platformName': 'Android',
'deviceName':'m3_note',
'udid': device_id,
'appPackage': APP_PACKAGE,
'appActivity': APP_ACTIVITY,
'unicodeKeyboard': True,
'resetKeyboard': True,
'noReset':not APP_RESET,
'newCommandTimeout':4000 // 单位S
}
remote_url = 'http://localhost:' + str(port) + '/wd/hub'
print(remote_url)
time.sleep(5)
driver = webdriver.Remote(remote_url, desired_caps)
start_add_friend(driver, device_id)
return driver
网友评论