Appium Activity used to start app doesn't exist! Make sure it exists

Chelsea · 2014年05月03日 · 最后由 Chelsea 回复于 2014年05月04日 · 1494 次阅读

新手请教:
Windows+Python+Andriod4.4
请问是我的 app-activity 写错了吗?请赐教~

import os
from selenium import webdriver
from selenium.webdriver.remote.webdriver import WebDriver

PATH = "F:\sample-code\apps\ContactManager\ContactManager.apk"

desired_caps = {}
desired_caps['device'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['platfrom'] = 'windows'
desired_caps['version'] = '4.2'
desired_caps['app'] = PATH
desired_caps['app-package'] = 'com.example.android.contactmanager'
desired_caps['app-activity'] = '.ContactManager'

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

WebDriver.implicitly_wait(20)

el = driver.find_element_by_name("Add Contact")
el.click()

textfields = driver.find_elements_by_tag_name("textfield")
textfields[0].send_keys("My Name")
textfields[2].send_keys("someone@somewhere.com")

driver.find_element_by_name("Save").click()

driver.quit()

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

共收到 3 条回复 时间 点赞

问题解决了,是我的 apk 有问题,重新装一个就可以了,谢谢大家~

你这个 apk 不是从官方下的么?怎么会有问题呢?

之前是在网上随便找了一个,现在好了

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