Appium python-appium-client 连接 appium-server 报错

cheunghr · 2019年07月17日 · 最后由 cheunghr 回复于 2019年07月18日 · 2125 次阅读

源码

连接的是模拟器

import time
from appium import webdriver
from selenium.webdriver.common.by import By

capabilities = {}
capabilities['platformName'] = 'Android'
capabilities['deviceName'] = 'WTK7N17112004938'
capabilities['noRest'] = 'true'
capabilities['platformVersion'] = '5.1.1'
capabilities['app'] = 'C:\\Users\\beix\\Desktop\\A_0712.apk'
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', capabilities)
#capabilities['appWaiteActivity'] = 'com.XXX.mall.activity.WelcomeActivity'
size = driver.get_window_size()
x = size['width']
y = size['height']
time.sleep(2)
driver.swipe(3*x/4, y/2, x/4, y/2, 400)
driver.find_elements_by_id('com.XXX.XXX:id/tv_tab_title')[4].click()
driver.find_element_by_id('com.XXX.XXX:id/et_phone').send_keys('XXX')
driver.find_element_by_id('com.XXX.XXX:id/et_valikey').send_keys('XXX')
driver.find_element_by_id('com.XXX.XXX:id/tv_login').click()
共收到 3 条回复 时间 点赞

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.agui.mall' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'D:\android_sdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1:21503 shell am start -W -n com.XXX.XXX/com.XXX.XXX.activity.WelcomeActivity -S' timed out after 20000ms'; Stderr: ''; Code: 'null'

用手机连接没有问题。但是模拟器不行,已经百度很久也没解决,只能劳烦一下各位

cheunghr 回复

看这错误是 app 启动超时了,你确定模拟器上安装 app 成功了吗?手动打开能打开吗

cmlanche 回复

APP 问题,我换成其他 APP 是好的😅

cheunghr 关闭了讨论 07月18日 09:46
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册