待测试应用的所有数据都被我清零,是为了测试首次打开 app 的几个提示界面,如果这几个界面操作过了第二次打开就不会再出现。这个是测试场景:
我的环境是:
appium-1.4.16(安装的 GUI)
windows10-64
python-2.7.13
我的第一个测试用例成功,第二个失败,提示信息是 activity 没有被使用。
logging 的提示:
test001_welcome_to_mainpage (main.JabraSportLifeTest) ... ok
test002_swipe_by_show_hide_framelayout (main.JabraSportLifeTest) ... ERROR
======================================================================
Traceback (most recent call last):
File "c:/Users/speng/Desktop/JabraSportLifeAutomation.py", line 25, in setUp
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
File "C:\Python27\lib\site-packages\appium\webdriver\webdriver.py", line 36, in init
super(WebDriver, self).init(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 140, in init
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 229, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 297, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: A new session could not be created. (Original error: com.jabra.sport/.core.ui.SplashActivity never started. Current: com.jabra.sport/.core.ui.FirstStartGuideActivity)
然后是 appium 的 server 的日志:
error: Failed to start an Appium session, err was: Error: com.jabra.sport/.core.ui.SplashActivity never started. Current: com.jabra.sport/.core.ui.FirstStartGuideActivity
info: [debug] Error: com.jabra.sport/.core.ui.SplashActivity never started. Current: com.jabra.sport/.core.ui.FirstStartGuideActivity
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1314:12)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1258:7)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: com.jabra.sport/.core.ui.SplashActivity never started. Current: com.jabra.sport/.core.ui.FirstStartGuideActivity)","origValue":"com.jabra.sport/.core.ui.SplashActivity never started. Current: com.jabra.sport/.core.ui.FirstStartGuideActivity"},"sessionId":null}
info: <-- POST /wd/hub/session 500 28197.879 ms - 346
我在 setup():里面的 activity 的确是用的 com.jabra.sport/.core.ui.SplashActivity,但是第二次打开 app 用到的 acitivity 就变成了 com.jabra.sport/.core.ui.FirstStartGuideActivity。
我也看了论坛里的帖子:https://testerhome.com/topics/6310
我按照回答的提示,把 “override existing session” 的选项勾上,而且重新启动了,还是不管用。
有没有类似问题的兄弟,大神,给点提示呢?