簡單測試用例

*** 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章