新手请教:
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)"