Appium [已解决]Activity used to start app doesn't exist

Evan · 2014年01月06日 · 最后由 Evan 回复于 2014年01月07日 · 1204 次阅读

新手求救:
环境是 Windows+Python+Andriod4.4

连最起码的 启动都起不来,不知道什么原因: 请大拿帮助:
import os
from selenium import webdriver

desired_caps = {}
desired_caps['device'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.4'
desired_caps['app'] = 'E:\Andriod\APK\FAMIBOT_debug.apk'
desired_caps['app-package'] = 'com.ecovacs'
desired_caps['app-activity'] = 'Ecologin'

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

driver.quit()

log:

Traceback (most recent call last):
  File "E:\Andriod\WorkSpace\DaogouTest\src\com\ecovacs\daogou.py", line 13, in
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
  File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 71, in init
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 113, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 164, in execute
    self.error_handler.check_response(response)
  File "C:\Python33\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 164, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: "A new session could not be created. (Original error: Activity used to start app doesn't exist! Make sure it exists)" 

可是我查过了 activity 是正确的。

共收到 8 条回复 时间 点赞

activity 写错了吧。。。前面加个点试试 '.Ecologin'

Evan #7 · 2014年01月06日 Author

#1 楼 @spikeshen 嗯 好了 com.ecovacs.EcoLogin' 这样子写就可以了 谢谢

Evan #3 · 2014年01月06日 Author

#1 楼 @spikeshen 请教一下 怎么样去抓页面元素啊? 像 selenium web 那样 抓页面的元素?有什么好的工具或者方法吗?

#2 楼 @sundaxian 你应该都不用写 com.ecovacs

#3 楼 @sundaxian 我直接用的 android sdk 里面的 monitor,可以把当前 ui dump 下来。你可以问问其他人用的啥,他们一般用的那个更高大上。

Evan #6 · 2014年01月06日 Author

#5 楼 @spikeshen 好的 谢谢

亲,加个头像吧

Evan #8 · 2014年01月07日 Author

#7 楼 @lihuazhang 我头像加不了 点击都没有相应的啊

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