简单测试用例

*** Settings ***
Suite Setup       open baidu
Suite Teardown
Library           Selenium2Library
Library           Collections

*** Test Cases ***
test
    input text    css=#kw[name="wd"]    csdn    # 输入csdn在百度输入框
    Click Element    css=input[id="su"] #点击回车
    sleep    3s
    Wait Until Page Contains Element    xpath=//*[@id="1"]/h3/a[1][@target="_blank"]    #判断csdn主页面是否出现
    sleep    1s
    Click Element    xpath=//*[@id="1"]/h3/a[1][@target="_blank"]   #点击csdn主页面
    sleep    3s
    ${titles}    Get Window Handles #获取所有标签页Handles
    Select Window    ${titles[2]}   #选择想要调转的标签页,从0开始是第一个
    Click Element    xpath=//*[@id="csdn_container_tool"]/div/ul/li[3]/a    #点击登录
    Click Element    xpath=//*[@id="app"]/div/div/div[1]/div[2]/div[5]/ul/li[2]/a    #选择账号密码登录
    sleep    3s
    input text    css=#all    13552322337   #输入账号
    input password    css=#password-number    f111111   #输入密码
    Click Element    css=.btn-primary   #点击登录

*** Keywords ***
open baidu
    Open Browser    https://www.baidu.com/    chrome
    Selenium2Library.Set Window Size    1920    1080

你可能感兴趣的:(自动化测试)