2023-11-25 09:18:56 +00:00
|
|
|
|
*** Settings ***
|
|
|
|
|
Suite Teardown Close Browser # 关闭浏览器
|
|
|
|
|
Library Selenium2Library
|
|
|
|
|
|
|
|
|
|
*** Variables ***
|
|
|
|
|
${username} sys_admin # 用户名
|
|
|
|
|
${passwd} test@2008 # 密码
|
|
|
|
|
${local_ip} 10.9.1.71 # 本地IP
|
2023-11-27 05:24:45 +00:00
|
|
|
|
${unbackup} https://10.10.20.172/#/login # 黑方地址
|
2023-11-25 09:18:56 +00:00
|
|
|
|
${driver} Firefox # 浏览器类型
|
|
|
|
|
|
|
|
|
|
*** Test Cases ***
|
|
|
|
|
CheckLastLoginIP
|
|
|
|
|
#打开浏览器并等待黑方页面加载完成
|
|
|
|
|
Open Browser ${unbackup} ${driver}
|
2023-11-25 09:43:16 +00:00
|
|
|
|
Wait Until Element Is Visible id=slogan 10s 黑方打开失败
|
2023-11-25 09:18:56 +00:00
|
|
|
|
#输入用户名
|
|
|
|
|
Set Focus To Element id=userName
|
|
|
|
|
Input Text id=userName ${username}
|
|
|
|
|
#输入密码
|
|
|
|
|
Set Focus To Element id=passWord
|
|
|
|
|
Input Text id=passWord ${passwd}
|
|
|
|
|
#点击登录
|
|
|
|
|
Set Focus To Element id=login_btn
|
|
|
|
|
Click Element id=login_btn
|
2023-11-25 09:43:16 +00:00
|
|
|
|
Wait Until Element Is Not Visible id=login_btn 30s 黑方登录失败
|
2023-11-25 09:18:56 +00:00
|
|
|
|
#点击右上角的登录记录
|
|
|
|
|
Set Focus To Element xpath=//a[text()="登录记录"]
|
|
|
|
|
Click Element xpath=//a[text()="登录记录"]
|
2023-11-27 05:24:45 +00:00
|
|
|
|
Sleep 3s
|
2023-11-25 09:18:56 +00:00
|
|
|
|
Element Should Be Visible xpath=//span[text()='上次登录IP地址']
|
|
|
|
|
Element Should Be Visible xpath=//span[text()='上次登录时间']
|
|
|
|
|
Element Should Be Visible xpath=//span[text()='登录状态']
|
|
|
|
|
#取表格中的第一个IP地址做比较
|
2023-11-25 09:43:16 +00:00
|
|
|
|
Element Text Should Be xpath=(//td[@data-field='ipAddr'])[1]/div[text()] ${local_ip} 检查失败,最近登录的IP不是${local_ip}
|