Robotframework+Selenium2Library+AppiumLibrary
我们要测试一个 android hybird app
我尝试使用 appium open application 打开 app 并能成功 switch to webview
接下来想用 Sleniume2LIbrary keyword 操作页面 但是一直得到错误说 canot active webview。robot case 和结果如下
这 2 个 library 是不是不能一起使用?
也尝试了用 open browser 打开 app 然后想利用 appium 的 swtich context 但是报错 no application open。如何能同时使用 2 个 library 呢。。
${desired_capabilities} Create Dictionary browserName=Android platformName=Android deviceName=f0ba3776
Open Application http://localhost:4723/wd/hub
sleep 30
get contexts
log 3
sleep 2
${print} Get Current Context
switch to context WEBVIEW_com.sg.sg.bmw
${print} Get Current Context
log 4
sleep 20
Wait Until Page Contains Element ${BMW USERNAME XPATH}
=================
结果如下:
20150611 11:47:32.970 : INFO : ${desired_capabilities} = {u'browserName': u'Android', u'platformName': u'Android', u'deviceName': u'f....
20150611 11:48:14.485 : INFO : Slept 30 seconds
20150611 11:48:16.984 : INFO : [u'NATIVE_APP', u'WEBVIEW_com.tencent.news', u'WEBVIEW_com.android.browser', u'WEBVIEW_com.android.settings', u'WEBVIEW_com.sg.sg.bmw']
20150611 11:48:16.987 : INFO : 3
20150611 11:48:18.991 : INFO : Slept 2 seconds
20150611 11:48:18.998 : INFO : ${print} = NATIVE_APP
20150611 11:48:21.002 : INFO : ${print} = WEBVIEW_com.sg.sg.bmw
20150611 11:48:21.004 : INFO : 4
20150611 11:48:41.023 : INFO : Slept 20 seconds
20150611 11:48:41.520 : FAIL :
WebDriverException: Message: unknown error: cannot activate web view
(Session info: webview=)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Mac OS X 10.10.0 x86_64)
20150611 11:48:41.522 : WARN :
Keyword 'Capture Page Screenshot' could not be run on failure: WebDriverException: Message: unknown error: cannot activate web view
(Session info: webview=)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Mac OS X 10.10.0 x86_64)
20150611 11:48:41.523 : FAIL :
WebDriverException: Message: unknown error: cannot activate web view
(Session info: webview=)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Mac OS X 10.10.0 x86_64)
20150611 11:48:41.525 : WARN :
Keyword 'Capture Page Screenshot' could not be run on failure: WebDriverException: Message: unknown error: cannot activate web view
(Session info: webview=)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Mac OS X 10.10.0 x86_64)
20150611 11:48:41.546 : FAIL : No browser is open
Starting test: RobotCase PK Mantenance.Robot - PK.TestSuit.Login.Login.005_Login with Correct UserName and Correct Password
Ending test: RobotCase PK Mantenance.Robot - PK.TestSuit.Login.Login.005_Login with Correct UserName and Correct Password