84 lines
3.9 KiB
Plaintext
84 lines
3.9 KiB
Plaintext
*** Settings ***
|
|
Library Selenium2Library
|
|
Resource ../../../03-Variable/BifangApiVariable.txt
|
|
Library Selenium2Library
|
|
Resource ../objects/Objects.robot
|
|
Resource ../objects/ObjectPages.robot
|
|
|
|
*** Keywords ***
|
|
Login_Restrictions
|
|
[Arguments] ${Login-Restrictions}=1 ${ip-type}=1 ${ip-value}=[192.2.2.2/24] ${ip-value1}=[192.2.2.2/24] ${Maximum-Login-Attemepts}=1 ${Maximum-Login-Attemepts-valuie}=5 ${Lock-Time}=1 ${Lock-Time-valuie}=60
|
|
sleep 1
|
|
Menu administration Login Restrictions #点击菜单Login Restrictions
|
|
sleep 1
|
|
${class}= Get Element Attribute xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[1]/div/div class #获取Login-Restrictions按钮的class元素的值
|
|
#通过元素的值判断按钮是开启状态还是关闭状态
|
|
run keyword if "${Login-Restrictions}"=="open" and "${class}"=="el-switch is-checked" log 按钮为开启状态,不进行操作
|
|
run keyword if "${Login-Restrictions}"=="open" and "${class}"=="el-switch" Run Keywords log 按钮为关闭状态,需要点击开启
|
|
... AND sleep 1
|
|
... AND click element link=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[1]/div/div
|
|
run keyword if "${Login-Restrictions}"=="close" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,需要点击关闭
|
|
... AND sleep 1
|
|
... AND click element xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[1]/div/div
|
|
run keyword if "${Login-Restrictions}"=="close" and "${class}"=="el-switch" log 按钮为关闭状态,不进行操作
|
|
sleep 1
|
|
#判断操作类型
|
|
run keyword if "${ip-type}"=="create" Ip-Create ${ip-value}
|
|
run keyword if "${ip-type}"=="edit" IP-Edit ${ip-value} ${ip-value1}
|
|
run keyword if "${ip-type}"=="delete" IP-Delete ${ip-value}
|
|
run keyword if "${Maximum-Login-Attemepts}"=="input" input text xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[3]/div/div/input ${Maximum-Login-Attemepts-valuie}
|
|
run keyword if "${Lock-Time}"=="input" input text xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[3]/div/div/input ${Lock-Time-valuie}
|
|
sleep 1
|
|
click element id=wanAdd_ok
|
|
sleep 1
|
|
${Text} get text xpath=/div/p
|
|
sleep 2
|
|
Should Be Equal As Strings ${Text} Success #断言
|
|
|
|
Ip-Create
|
|
[Arguments] ${ip}
|
|
${j} get length ${ip}
|
|
sleep 1
|
|
: FOR ${i} IN RANGE ${j}
|
|
\ sleep 1
|
|
\ click element id=temporary_form
|
|
\ sleep 1
|
|
\ input text id=statusInputedit ${ip}[${i}]
|
|
\ sleep 1
|
|
sleep 1
|
|
|
|
IP-search
|
|
[Arguments] ${ip}
|
|
sleep 1
|
|
input text id=object_ip_search ${ip}
|
|
sleep 1
|
|
press keys id=object_ip_search ENTER
|
|
|
|
IP-Edit
|
|
[Arguments] ${ip} ${new_ip}
|
|
${j} get length ${ip}
|
|
sleep 1
|
|
: FOR ${i} IN RANGE ${j}
|
|
\ sleep 1
|
|
\ IP-search ${ip}[${i}]
|
|
\ sleep 1
|
|
\ Click Element //*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[2][text()="${ip}[${i}]"] #点击修改按钮
|
|
\ sleep 1
|
|
\ input text id=statusInputedit ${new_ip} #输入修改后的ip
|
|
sleep 1
|
|
|
|
|
|
IP-Delete
|
|
[Arguments] ${ip}
|
|
${j} get length ${ip}
|
|
sleep 1
|
|
: FOR ${i} IN RANGE ${j}
|
|
\ sleep 1
|
|
\ IP-search ${ip}[${i}]
|
|
\ sleep 1
|
|
\ click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/div/div[2]/div/div/form/div[2]/div/div[1]/div[2]/div[1]/div/div/div/div/div[2]/i[2] #点击删除按钮
|
|
\ sleep 1
|
|
sleep 1
|
|
|
|
|