【问题标题】:How to fix an error "FAIL : ValueError: Element locator" in AppiumLibrary with Robotframework?如何使用 Robotframework 修复 AppiumLibrary 中的错误“FAIL:ValueError:Element locator”?
【发布时间】:2018-04-29 18:46:19
【问题描述】:

我正在使用 AppiumLibraryRobotframwork 并遇到错误 FAIL : ValueError: Element locator '//*[@text="STG"]' did not match any elements

Test Case1
| FAIL |
ValueError: Element locator '//*[@text="STG"]' did not match any elements.

这是测试用例:

**Settings**: Library AppiumLibrary

**Test Cases**: Test Case1 

    Open Application    http://localhost:4723/wd/hub  
    platformName=Android  deviceName=ZY22452GQX    
    app=/home/keval/Desktop/extra/app-rheem-qa(1).apk    
    appPackage=com.rheem.econetconsumerandroid.qa    
    appActivity=com.econet.ui.MainActivity

    Click Element    id=com.rheem.econetconsumerandroid.qa:id/
    activity_login_logo_image_view
    Click Element    id=com.rheem.econetconsumerandroid.qa:id/
    activity_login_logo_image_view
    Click Element    id=com.rheem.econetconsumerandroid.qa:id/
    activity_login_logo_image_view
    Click Text    text=STG    exact_match=False
    Click Element    id=com.rheem.econetconsumerandroid.qa:id/menu_save
    Input Text    id=com.rheem.econetconsumerandroid.qa:id/
    login_email_text    text=deepali.gill@volansystech.com
    Input Password    id=com.rheem.econetconsumerandroid.qa:id/
    login_password_text    text=kalpesh@2017
    Click Element    id=com.rheem.econetconsumerandroid.qa:id/login_button

【问题讨论】:

  • 这不是问题。
  • 您似乎没有在等待屏幕完成渲染。如果在导致错误的行之前添加等待或睡眠,错误会消失吗?

标签: automation appium robotframework appium-android


【解决方案1】:

定位器看起来是有效的。看起来你正在登录,所以可能需要等待元素出现在 UI 上:

Wait Until Page Contains Element  //*[@text="STG"]

More details

【讨论】:

    猜你喜欢
    • 2019-07-15
    • 1970-01-01
    • 2021-11-24
    • 2017-04-15
    • 1970-01-01
    • 2019-02-22
    • 2019-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多