新手区 【已解决】请问大家,脚本报错,Activity used to start app doesn't exist or canno t be launched

ma · 2014年09月01日 · 最后由 ma 回复于 2014年09月01日 · 1250 次阅读
import os
from selenium import webdriver

PATH = lambda p: os.path.abspath(
    os.path.join(os.path.dirname(__file__), p)
)

desired_caps = {}
desired_caps['deviceName'] = '2013022'
desired_caps['platformName'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2'
desired_caps['app'] = r'C:\Users\mazhigang\Desktop\AndroidStorm.apk'
desired_caps['appPackage'] = 'com.storm.smart'
desired_caps['appActivity'] = '.StormApplication'

driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)

这是报错:
selenium.common.exceptions.WebDriverException: Message: u"A new session could no
t be created. (Original error: Activity used to start app doesn't exist or canno
t be launched! Make sure it exists and is a launchable activity)"

运行这个脚本已经能自动安装应用了,然后包这个错误。

共收到 2 条回复 时间 点赞

你的 appActivity 参数不对,不存在或者不是启动 activity

ma #1 · 2014年09月01日 Author

#1 楼 @hobbs 谢谢。问题解决了。是 activity 不对。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册