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}
\ 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] #点击删除按钮