本文介绍了如何使用Robot Framework和Appium在Emulator上打开浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试配置机器人框架以在Android模拟器中打开Chrome浏览器.我有以下代码可以做到这一点:
I am trying to configure Robot Framework to open Chrome Browser in an android emulator. I have this code to do that:
*** Settings ***
Suite Setup Set Library Search Order SeleniumLibrary
Test Setup Open page
Test Teardown Close Page
Library SeleniumLibrary
Library Collections
Library requests
Library AppiumLibrary
*** Test Cases ***
Test_case_sample
Go To https://www.google.com
Sleep 10s
*** Keywords ***
Open Page
${desired_capabilities}= Create Dictionary
Set to Dictionary ${desired_capabilities} deviceName Demo_6_Inch
# Set to Dictionary ${desired_capabilities} build test_run
Set to Dictionary ${desired_capabilities} platformName Android
Set to Dictionary ${desired_capabilities} name test_case_Sample
Set to Dictionary ${desired_capabilities} platformVersion 8.0
Set to Dictionary ${desired_capabilities} deviceOrientation portrait
Set to Dictionary ${desired_capabilities} browserName Chrome
Set to Dictionary ${desired_capabilities} appiumVersion 1.7.1
Set to Dictionary ${desired_capabilities} deviceType phone
Create Webdriver Remote desired_capabilities=${desired_capabilities}
Close Page
Close All Applications
运行脚本时,出现以下错误:
When running the script, I get the following error :
然后我在localhost:4444启动了一个硒Webdriver实例.但是这次我得到了这个错误:
I than started an instance of selenium webdriver at localhost:4444 . But this time I got this error:
如何克服这个问题并运行模拟器?
How can I overcome this and run the emulator?
感谢您提出的解决此问题的建议
Thanks for your suggestion to solve this
推荐答案
最后找到了简单的解决方案:
Finally found the simple solution :
*** Settings ***
Library SeleniumLibrary
Library Collections
*** Variables ***
*** Test Cases ***
AndroidConnection
${Options} Create Dictionary androidPackage com.android.chrome
${caps} Create Dictionary chromeOptions ${Options}
Set to Dictionary ${caps} platformName Android
Set to Dictionary ${caps} platformVersion 8.0
Set To Dictionary ${caps} deviceName emulator-5554
Set To Dictionary ${caps} browserName Chrome
Create Webdriver Remote command_executor=http://localhost:4723/wd/hub desired_capabilities=${caps}
go to http://www.google.com
Close Browser
这篇关于如何使用Robot Framework和Appium在Emulator上打开浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!