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

ma · September 01, 2014 · Last by ma replied at September 01, 2014 · 1148 hits
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 #2 · September 01, 2014 作者

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

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up