robotframework_百度登陆

** Settings ***
Library Selenium2Library

*** Test Cases ***
login
    Open Browser https://www.baidu.com/ gc
    Set Browser Implicit Wait 30
    Maximize Browser Window
    Click Element xpath=//div[@id='u1']/a[text()='登录']
    Sleep 3s
    Click Element xpath=//p[text()='用户名登录']
    Sleep 3s
    # 获取文本信息
    ${login_text} Get Text xpath=//p[text()='用户名密码登录']
    # 校验页面是否包含该文本信息
    Should Contain ${login_text} 用户名密码登录
    Sleep 3s
    # 校验页面是否包含元素
    Wait Until Page Contains 用户名密码登录 30s
    Input Text xpath=//input[@name='userName'] 账号
    Sleep 3s
    Input Password xpath=//input[@name='password'] 密码
    Sleep 3s
    Click Button xpath=//input[@type='submit' and @value='登录' and @id='TANGRAM__PSP_10__submit']
    Sleep 10s
    Close All Browsers

 

 

posted @ 2018-07-25 16:29  含笑半步颠√  阅读(268)  评论(0编辑  收藏  举报