如何使用Robotframwork在AppiumLibrary中修复错误“FAIL:ValueError:Element locator”?

时间:2017-11-16 09:37:05

标签: automation appium robotframework appium-android

我正与AppiumLibrary Robotframwork合作,发现错误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

1 个答案:

答案 0 :(得分:0)

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

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

More details