美文网首页Appium自动化测试
robotframework启动Chrome浏览器

robotframework启动Chrome浏览器

作者: 夜尽雪舞 | 来源:发表于2020-02-23 11:26 被阅读0次

    方法一:

    Open Application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=${platformVersion} deviceName= ${deviceName} browserName=Chrome unicodeKeyboard=true resetKeyboard=true chromedriverExecutableDir=D:/WanleAutoTestForH5/ChromeDrivers/78.0.3904.70

    #如果出现权限弹框则切换至原生状态,接受弹框即可

    ${contexts} Get Contexts

    Switch To Context NATIVE_APP

    Run Keyword And Ignore Error click element xpath=(//android.widget.Button)[2]

    方法二:作为原生软件启动后切换至webview_chrome,原生启动的好处是可以设置noReset=true而缓存一些

    权限设置

    Open Application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=${platformVersion} deviceName=${deviceName} appPackage=com.android.chrome appActivity=com.google.android.apps.chrome.Main unicodeKeyboard=true resetKeyboard=true chromedriverExecutableDir=D:/WanleAutoTestForH5/ChromeDrivers/78.0.3904.70 recreateChromeDriverSessions=true noReset=true

    ${contexts} get contexts

    ${status} Run Keyword And Return Status Page Should Contain Element xpath=(//android.widget.Button[@text="允许"])

    run keyword if '${status}'=='True' click element xpath=(//android.widget.Button[@text="允许"])

    click element xpath=(//android.widget.EditText)[1]

    input text xpath=(//android.widget.EditText)[1] ${url}

    Press Keycode 66

    ${contexts} get contexts

    switch to context WEBVIEW_chrome

    相关文章

      网友评论

        本文标题:robotframework启动Chrome浏览器

        本文链接:https://www.haomeiwen.com/subject/bmodqhtx.html