1、提交修改安全策略case,和添加Teardown,2、提交代理策略新建关键字

This commit is contained in:
lyf
2021-02-03 18:36:18 +08:00
parent 6cedde8526
commit 2c5fec6cb1
3 changed files with 804 additions and 766 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -241,10 +241,87 @@ Deny-Redirect
sleep 1 sleep 1
click element id=interceptionadd_shezhidns click element id=interceptionadd_shezhidns
Replace-Action-Parameters Replace-Action-Parameters-for1
[Arguments] ${ParametersType} ${RequestURIFind}=null ${RequestURIReplacewith}=null ${RequestBodyFind}=null ${RequestBodyReplacewith}=null ${ResponseBodyFind}=null
... ${ResponseBodyReplacewith}=null ${RequestHeaderFind}=null ${RequestHeaderReplacewith}=null ${ResponseHeaderFind}=null ${ResponseHeaderReplacewith}=null
[Documentation] 调用次关键字前需要添加必填参数:
... ${ParametersType}:列表格式Search 下拉框中内容
... ${i}:索引值
... ${xxxFind}是Find输入框输入的值
... ${XXXReplacewith} :是 Replacewith输入框中输入的值
${len} Get Length ${ParametersType}
${len1} evaluate ${len}+1
FOR ${i} IN RANGE 1 ${len1}
Replace-Action-Parameters-for1 ${ParametersType} ${i} ${RequestURIFind} ${RequestURIReplacewith} ${RequestBodyFind} ${RequestBodyReplacewith} ${ResponseBodyFind}
... ${ResponseBodyReplacewith} ${RequestHeaderFind} ${RequestHeaderReplacewith} ${ResponseHeaderFind} ${ResponseHeaderReplacewith}
sleep 1
run keyword if "${len}"!="1" run keywords sleep 1
... AND clcik element id=replaceadd_btn
... AND sleep 1
END
sleep 1 sleep 1
run keyword if "${ParametersNumber}"=="Search" run keywords sleep 1
... AND input text xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ${ProfileName} Replace-Action-Parameters-for2
[Arguments] ${ParametersType} ${i} ${RequestURIFind} ${RequestURIReplacewith} ${RequestBodyFind} ${RequestBodyReplacewith} ${ResponseBodyFind}
... ${ResponseBodyReplacewith} ${RequestHeaderFind} ${RequestHeaderReplacewith} ${ResponseHeaderFind} ${ResponseHeaderReplacewith}
[Documentation] 调用次关键字前需要添加必填参数:
... ${ParametersType}:列表格式Search 下拉框中内容
... ${i}:索引值
... ${xxxFind}是Find输入框输入的值
... ${XXXReplacewith} :是 Replacewith输入框中输入的值
FOR ${j} IN @{ParametersType}
run keyword if "${j}"=="RequestURI" run keywords sleep 1
... AND click element xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[1]/div/div/div[1]/input
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[2]/div/div/input ${RequestURIFind}
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[3]/div/div/input ${RequestURIReplacewith}
... AND sleep 1
run keyword if "${j}"=="RequestBody" run keywords sleep 1
... AND click element xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[1]/div/div/div[1]/input
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[2]/div/div/input ${RequestBodyFind}
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[3]/div/div/input ${RequestBodyReplacewith}
... AND sleep 1
run keyword if "${j}"=="ResponseBody" run keywords sleep 1
... AND click element xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[1]/div/div/div[1]/input
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[2]/div/div/input ${ResponseBodyFind}
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[3]/div/div/input ${ResponseBodyReplacewith}
... AND sleep 1
run keyword if "${j}"=="RequestHeader" run keywords sleep 1
... AND click element xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[1]/div/div/div[1]/input
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[2]/div/div/input ${RequestHeaderFind}
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[3]/div/div/input ${RequestHeaderReplacewith}
... AND sleep 1
run keyword if "${j}"=="ResponseHeader" run keywords sleep 1
... AND click element xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[1]/div/div/div[1]/input
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[2]/div/div/input ${ResponseHeaderFind}
... AND sleep 1
... AND input text xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[3]/ul/li[${i}]/div[3]/div/div/input ${ResponseHeaderReplacewith}
... AND sleep 1
END
HijackFile-SearchorCreate
[Arguments] ${SearchorCreate} ${Hijackname} ${Hijackfile} ${dow_name} ${input} ${Hijackname} ${Hijacktype}
[Documentation] 调用次关键字前需要添加必填参数:
... ${SearchorCreate}:填入Search或Create
... ${Hijackname}:填入新建hijack的name
... ${Hijackfile}:填入新建hijack文件的路径
... ${dow_name}:根据情况填入close或open或其他
... ${input}填入shuru或其他
... ${Hijacktype}:填入选择文件类型的元素
... 判断是新建还是搜索HijackFile
sleep 1
click element xpath=//*[@id="policy_paper_left"]/div[12]/div/div/form/div[4]/div/div/div/div
sleep 1
run keyword if "${SearchorCreate}"=="Search" run keywords sleep 1
... AND input text xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ${Hijackname}
... AND sleep 1 ... AND sleep 1
... AND press keys xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ENTER ... AND press keys xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ENTER
... AND sleep 1 ... AND sleep 1
@@ -253,253 +330,116 @@ Replace-Action-Parameters
... ELSE IF "${SearchorCreate}"=="Create" run keywords sleep 1 ... ELSE IF "${SearchorCreate}"=="Create" run keywords sleep 1
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[1]/div/div/button ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[1]/div/div/button
... AND sleep 1 ... AND sleep 1
... AND HijackFile-Create ${Hijackname} ${Hijackfile} ${dow_name} ${input} ${Hijackname} ${Hijacktype}
... ELSE log 传入参数错误
Intercept-SSL-Keyring-SearchorCreate HijackFile-Create
[Arguments] ${KeySearchorCreate} ${keyname} ${file}=null ${file1}=null ${ExpiryHours1or2}=null ${type}=null ${type1}=null [Arguments] ${Hijackname} ${Hijackfile} ${dow_name} ${input} ${Hijackname} ${Hijacktype}
... ${shift}=close ${PrivateKeyType}=PrivateKeyFile [Documentation] 调用次关键字前需要添加必填参数:
[Documentation] 引用次关键字,填入必填参数 ... ${Hijackname}:填入新建hijack的name
... 必填参数: ... ${Hijackfile}:填入新建hijack文件的路径
... ${KeySearchorCreate}:填入Create或Search ... ${dow_name}:根据情况填入close或open或其他
... ${name}:新建页面name输入框里的内容 ... ${input}填入shuru或其他
... ${file}:上传文件所在本地的路径 ... ${Hijacktype}:填入选择文件类型的元素
... ${file1}:上传文件所在本地的路径 ... 新建hijack
... ${ExpiryHours1or2}:根证书时间填入1自定义定义 2:原时间
... ${type}:上传证书类型的元素
... ${type1}:上传证书加密解密算法的元素
... ${shift}:是否打开客户端包含证书按钮
... ${PrivateKeyType}:私钥类型
sleep 1
click element id=interceptionadd_eventkeying1
sleep 1
run keyword if "${KeySearchorCreate}"=="Create" run keywords sleep 1
... AND click element id=interceptionadd_keyadd
... AND sleep 2
... AND Create-Keyring ${keyname} ${file} ${file1} ${ExpiryHours1or2} ${type} ${type1}
... ${shift}=close ${PrivateKeyType}=PrivateKeyFile
run keyword if "${KeySearchorCreate}"=="Search" run keywords sleep 1
... AND input text id=card_keyringName1 ${keyname}
... AND sleep 1
... AND press keys id=card_keyringName1 ENTER
... AND sleep 1
... AND clcik element id=card_keylist0
Create-Keyring
[Arguments] ${name} ${file} ${file1} ${ExpiryHours1or2} ${type} ${type1}
... ${shift}=close ${PrivateKeyType}=PrivateKeyFile
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${name}:新建页面name输入框里的内容
... ${file}:上传文件所在本地的路径
... ${file1}:上传文件所在本地的路径
... ${ExpiryHours1or2}:根证书时间填入1自定义定义 2:原时间
... ${type}:上传证书类型的元素
... ${type1}:上传证书加密解密算法的元素
... ${shift}:是否打开客户端包含证书按钮
... ${PrivateKeyType}:私钥类型
Sleep 2 Sleep 2
input id=keyringsadd_name ${name} #输入name input id=hijack_profileName ${Hijackname} #输入name
Sleep 2 Sleep 2
Choose File xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[2]/div/div/div/input ${file} #上传文件 Choose File xpath=//*[@id="proxy"]/div[11]/div/div[1]/div[2]/form/div[2]/div/div/div[1]/input ${Hijackfile} #上传文件
Sleep 2 Sleep 2
Choose File xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[3]/div/div[2]/div/div/input ${file1} #上传文件 run keyword if "${dow_name}"=="close" and "${input}"=="shuru" run keywords sleep 1
${select} Set Variable ${ExpiryHours1or2} ... AND input text id=hijack_contentName ${Hijackname}
Run Keyword If '${select}'=='1' click element id=keyringsadd_customized ... ELSE IF "${dow_name}"=="open" click element xpath=//*[@id="contentNameChoose"]/div[1]/span[2]
Run Keyword If '${select}'=='1' input text id=reissueExpiryDate 10
sleep 1 sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[6]/div/div/div[1]/span/span/i #点击下拉框 click element id=hijackAddContentType #点击+ 打开侧滑窗口
sleep 1
click element ${type} #选择证书类型
sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[7]/div/div/div[1]/span/span/i #点击下拉框
sleep 1
click element ${type1} #选择加密解密类型
sleep 1
${root} Set Variable ${shift}
run keyword if "${root}"=="open" run keywords sleep 1
... AND click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[9]/div/div/span
... ELSE IF "${root}"=="close" log "go on"
Run Keyword If '${PrivateKeyType}'=='HSM' run keywords sleep 1
... AND click element id=privateHSM
... AND sleep 1
... AND input text id=keyringsadd_slotid 10
sleep 1
click id=keyringsadd_sub #点击OK缇交
Intercept-SSL-MirrorDecryptedTraffic-Open
[Arguments] ${MirrorDecryptedTraffic}=null ${MirrorDecryptedTrafficSearchorCreate}=null ${MirrorDecryptedTrafficname}=null ${type}=null ${shuru}=null
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${MirrorDecryptedTraffic}:输入open代表开启按钮其他代表不开启
... ${MirrorDecryptedTrafficSearchorCreate}填入Create或Search
... ${MirrorDecryptedTrafficname}:解密流量文件的name
... ${type}:是mac还是vlan的定位元素
... ${shuru}:输入mac或vlan的值
sleep 1
run keyword if "${MirrorDecryptedTraffic}"=="open" run keywords sleep 1
... AND click element xpath=///*[@id="policy_paper_left"]/div[10]/div[2]/label[contains(text(), "Mirror Decrypted Traffic")]/following-sibling::div/div
... AND sleep 1
... AND clcik element id=mirror_profile
... AND MirrorDecryptedTraffic-SearchorCreate ${MirrorDecryptedTrafficSearchorCreate} ${MirrorDecryptedTrafficname} ${type} ${shuru}
... ELSE log 不开启
MirrorDecryptedTraffic-SearchorCreate
[Arguments] ${MirrorDecryptedTrafficSearchorCreate} ${MirrorDecryptedTrafficname} ${type} ${shuru}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${MirrorDecryptedTrafficSearchorCreate}填入Create或Search
... ${MirrorDecryptedTrafficname}:解密流量文件的name
... ${type}:是mac还是vlan的定位元素
... ${shuru}:输入mac或vlan的值
sleep 1
run keyword if "${MirrorDecryptedTrafficSearchorCreate}"=="Create" run keywords sleep 1
... AND click element id=interceptionadd_trarightadd
... AND sleep 2
... AND Create-MirrorDecryptedTraffic ${MirrorDecryptedTrafficname} ${type} ${shuru}
run keyword if "${MirrorDecryptedTrafficSearchorCreate}"=="Search" run keywords sleep 1
... AND input text id=tradata_profileName ${MirrorDecryptedTrafficname}
... AND sleep 1
... AND press keys id=tradata_profileName ENTER
... AND sleep 1
... AND clcik element id=tralist_length0
Create-MirrorDecryptedTraffic
[Arguments] ${MirrorDecryptedTrafficname} ${type} ${shuru}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${MirrorDecryptedTrafficname}:解密流量文件的name
... ${type}:是mac还是vlan的定位元素
... ${shuru}:输入mac或vlan的值
Sleep 2
input id=trafficmirror_profileName ${MirrorDecryptedTrafficname} #输入name
Sleep 2
click id=addrTypeChoose #点击下拉框
Sleep 2
click ${type} #选择vlan或者mac
Sleep 1 Sleep 1
input id=trafficmirror_addrArray0 ${shuru} click element ${Hijacktype} #选择文件类型
sleep 2 sleep 2
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] #点击OK click element id=hijackAddOk1 #点击OK
DecryptionProfile-SearchorCreate
[Arguments] ${DecryptionProfileSearchorCreate}=null ${DecryptionProfilename}=null ${dict1}=null ${fail1}=null ${min1}=null ${max1}=null InsertScript-SearchorCreate
[Documentation] 引用次关键字,填入必填参数 [Arguments] ${SearchorCreate} ${Insertname} ${Insertfile} ${Inserttype} ${Insertjstype}
... 必填参数: [Documentation] 调用次关键字前需要添加必填参数:
... ${DecryptionProfileSearchorCreate}填入Create或Search ... ${SearchorCreate}:填入Search或Create
... ${DecryptionProfilename}:文件name ... ${Insertname}:填入新建insert的name
... ${dict1}:是个字典等于1为开启等于0为关闭例如Common Name=1 Issuer=1 Self-signed=1 Expiry Date=1 EV Certificat=1 ... ${Insertfile}:填入新建insert文件的路径
... Certificate Transparency=1 Mutual Authentication=1 On Protocol Errors=1 Certificate Pinning=1 Certificate Not Installed=1 Mirror Client Versions=1 ... ${Inserttype}:根据情况填入css或js
... Allow HTTP/2=1 ... ${Insertjstype}填入Before Page Load或After Page Load
... ${fail1} :输入Fail-close或Pass-through ... 判断是新建还是搜索insert
... ${min1}:输入协议版本, sleep 1
... ${max1}:输入协议版本, click element id=manipulation_select_insetScript
sleep 1 sleep 1
click element id=interceptionadd_eventkeying run keyword if "${SearchorCreate}"=="Search" run keywords sleep 1
sleep 1 ... AND input text xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ${Hijackname}
run keyword if "${DecryptionProfileSearchorCreate}"=="Create" run keywords sleep 1 ... AND sleep 1
... AND click element id=interceptionadd_decryptionProfileId ... AND press keys xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ENTER
... AND sleep 2 ... AND sleep 1
... AND Create-DecryptionProfile ${DecryptionProfilename} ${dict1} ${fail1} ${min1} ${max1} ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[2]/div/li[1]
run keyword if "${DecryptionProfileSearchorCreate}"=="Search" run keywords sleep 1 ... AND sleep 1
... AND input text id=card_keyringName ${DecryptionProfilename} ... ELSE IF "${SearchorCreate}"=="Create" run keywords sleep 1
... AND sleep 1 ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[1]/div/div/button
... AND press keys id=card_keyringName ENTER ... AND sleep 1
... AND sleep 1 ... AND InsertScript-Create ${Insertname} ${Insertfile} ${Inserttype} ${Insertjstype}
... AND clcik element xpath=//*[@id="decryptionProfileList"]/following-sibling::li[2] ... ELSE log 传入参数错误
Create-DecryptionProfile
[Arguments] ${name} ${dict1} ${fail1} ${min1} ${max1} InsertScript-Create
Sleep 1 [Arguments] ${Insertname} ${Insertfile} ${Inserttype} ${Insertjstype}
input id=insert_profileName ${name} [Documentation] 调用次关键字前需要添加必填参数:
Sleep 1 ... ${Insertname}:填入新建insert的name
DecryptionProfileButtonSwitch ${dict1} //*[@id="policy_Manipulation_create8"]/div[2]/form/div/div/label[contains(text(), " ")]/following-sibling::div/div el-switch is-checked el-switch ... ${Insertfile}:填入新建insert文件的路径
${fail} Set Variable ${fail1} ... ${Inserttype}:根据情况填入css或js
run keyword if "${fail}"=="Fail-close" Run Keywords sleep 1 ... ${Insertjstype}填入Before Page Load或After Page Load
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div[5]/div/div/label[1]/span ... 新建insert
... ELSE IF "${fail}"=="Pass-through" Run Keywords sleep 1 Sleep 2
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div[5]/div/div/label[2]/span input id=insert_profileName ${Insertname} #输入name
... ELSE log 1111 Sleep 2
${min} Set Variable ${min1} Choose File xpath=//*[@id="insertAddUpload"]/div[1]/input ${Insertfile} #上传文件
${max} Set Variable ${max1} Sleep 2
run keyword if "${min}"=="TLSv1.0" Run Keywords sleep 1 clcik element id=insert_select_format
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i sleep 1
... AND sleep 1 run keyword if "${Inserttype}"=="css" run keywords sleep 1
... AND click id=pro_min1 ... AND click element //span[.="${Inserttype}"] #选择css
... ELSE IF "${min}"=="TLSv1.1" Run Keywords sleep 1 run keyword if "${Inserttype}"=="js" run keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i ... AND click element //span[.="${Inserttype}"]
... AND sleep 1 ... AND sleep 1
... AND click id=pro_min2 ... AND click element id=insert_select_insertOn #点击下拉框
... ELSE IF "${min}"=="TLSv1.2" Run Keywords sleep 1 ... AND sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i ... AND click element //span[.="${Insertjstype}"]
... AND sleep 1 sleep 2
... AND click id=pro_min3 click element id=insertAddOk1 #点击OK
... ELSE IF "${min}"=="TLSv1.3" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i
... AND sleep 1
... AND click id=pro_min4
... ELSE IF "${min}"=="SSLv3.0" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i
... AND sleep 1
... AND click id=pro_min0
... ELSE log 错误
run keyword if "${max}"=="TLSv1.0" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i
... AND sleep 1
... AND click id=pro_max1
... ELSE IF "${max}"=="TLSv1.1" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i
... AND sleep 1
... AND click id=pro_max2
... ELSE IF "${max}"=="TLSv1.2" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i
... AND sleep 1
... AND click id=pro_max3
... ELSE IF "${max}"=="TLSv1.3" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i
... AND sleep 1
... AND click id=pro_max4
... ELSE IF "${max}"=="SSLv3.0" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i
... AND sleep 1
... AND click id=pro_max0
... ELSE log 错误
sleep 2
click id=decryption-ok
sleep 2
Settings-Search ${name} ${search} #搜索框的关键字
sleep 2
${name1} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr/td[2]/div/div/span
Should Be Equal As Strings ${name1} ${name}
DecryptionProfileButtonSwitch
[Arguments] ${dict1} ${xpath1} ${xpath2} ${open} ${close}
${dict} Set Variable ${dict1}
FOR ${list} ${key} IN ENUMERATE @{dict}
${class}= Get Element Attribute xpath=${xpath1}${key}${xpath2} class
run keyword if "${class}"=="${open}" and "${dict}[${key}]"=="1" log 默认开启,不进行操作
run keyword if "${class}"=="${open}" and "${dict}[${key}]"=="0" Run Keywords log 默认开启,但需求需要关闭,进行点击关闭按钮
... AND sleep 1
... AND click xpath=${xpath1}${key}${xpath2}/span
run keyword if "${class}"=="${close}" and "${dict}[${key}]"=="1" Run Keywords log 默认关闭,但需求需要开启,进行点击开启按钮
... AND sleep 1
... AND click xpath=${xpath1}${key}${xpath2}/span
run keyword if "${class}"=="${close}" and "${dict}[${key}]"=="0" log 默认关闭,不进行操作
END
LogSession LogSession
[Arguments] ${LogSession} [Arguments] ${LogSession}
[Documentation] 调用次关键字前需要添加必填参数: [Documentation] 调用次关键字前需要添加必填参数:
... ${LogSession}:填入clcos或其他 ... ${LogSession}:填入clcos或其他
run keyword if "${LogSession}"=="close" run keywords sleep 1 run keyword if "${LogSession}"=="close" run keywords sleep 1
... AND click element id=addlabel_labels_log ... AND click element id=manipulationSwitch0
... ELSE log 开启日志 ... ELSE log 开启日志
LogOptions
[Arguments] ${LogOptions}
[Documentation] 调用次关键字前需要添加必填参数:
... ${LogOptions}:填入All或其他
run keyword if "${LogOptions}"=="All" run keywords sleep 1
... AND click element id=logType1
... ELSE log 选择Metadata only
Enabled Enabled
[Arguments] ${Enabled} [Arguments] ${Enabled}
[Documentation] 调用次关键字前需要添加必填参数: [Documentation] 调用次关键字前需要添加必填参数:
... ${Enabled}:填入open或其他 ... ${Enabled}:填入open或其他
run keyword if "${Enabled}"=="open" run keywords sleep 1 run keyword if "${Enabled}"=="open" run keywords sleep 1
... AND click element xpath=//*[@id="policy_paper_left"]/div/label[contains(text(), "Enabled")]/following-sibling::div/div ... AND click element xpath=//*[@id="proxyManipulationUse"]/label[contains(text(), "Enabled")]/following-sibling::div/div
... AND sleep 2 ... AND sleep 2
... AND click element xpath=/html/body/div/div/div[3]/button[2] ... AND click element xpath=/html/body/div/div/div[3]/button[2]
... ELSE log 开启日志 ... ELSE log 开启日志
Security-Policies-OK Security-Policies-OK
sleep 1 sleep 1
click element id=interceptionadd_sub click element id=proxyManipulationSuccess
sleep 1
Create-Object-Search Create-Object-Search
[Arguments] ${name} ${filter} [Arguments] ${name} ${filter}
[Documentation] 调用次关键字前需要添加必填参数: [Documentation] 调用次关键字前需要添加必填参数:
@@ -899,9 +839,9 @@ DestinationCreate-ok
click button xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[2]/button[1] click button xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[2]/button[1]
Security-Source Proxy-Source
[Arguments] ${SourceType} ${SourceValue} [Arguments] ${SourceType} ${SourceValue}
Wait Until Element Is Enabled xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div 10 Wait Until Element Is Enabled xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div 10
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div
sleep 1 sleep 1
run keyword if "${SourceType}"=="ID" run keywords sleep 1 run keyword if "${SourceType}"=="ID" run keywords sleep 1
@@ -911,7 +851,7 @@ Security-Source
run keyword if "${SourceType}"=="Action" run keywords sleep 1 run keyword if "${SourceType}"=="Action" run keywords sleep 1
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[4] ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[4]
sleep 1 sleep 1
input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${SourceValue} input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${SourceValue}
sleep 1 sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i
sleep 1 sleep 1
@@ -920,7 +860,7 @@ Security-Source
EditButton EditButton
sleep 1 sleep 1
click element xpath=//*[@id="appEdit"]/span/div/div[2] click element xpath=//*[@id="appEdit"]/span/div/div[2]
sleep 1 sleep 1
Initialize-Policie Initialize-Policie
@@ -928,15 +868,21 @@ Initialize-Policie
[Documentation] 调用次关键字前需要添加必填参数: [Documentation] 调用次关键字前需要添加必填参数:
... ${InitializeAction}:根据用例进行填写意思就是是那一个action就不要点击哪一个以免初始化失败 ... ${InitializeAction}:根据用例进行填写意思就是是那一个action就不要点击哪一个以免初始化失败
run keyword if "${InitializeAction}"=="Allow" run keywords sleep 1 run keyword if "${InitializeAction}"=="Allow" run keywords sleep 1
... AND click element id=security_action_deny ... AND click element id=proxyManipulationdeny
... AND sleep 1 ... AND sleep 1
... ELSE IF "${InitializeAction}"=="Deny" run keywords sleep 1 ... ELSE IF "${InitializeAction}"=="Deny" run keywords sleep 1
... AND click element id=security_action_allow ... AND click element id=proxyManipulationallow
... ELSE IF "${InitializeAction}"=="Monitor" run keywords sleep 1 ... ELSE IF "${InitializeAction}"=="Monitor" run keywords sleep 1
... AND click element id=security_action_deny ... AND click element id=proxyManipulationdeny
... ELSE IF "${InitializeAction}"=="Intercept" run keywords sleep 1 ... ELSE IF "${InitializeAction}"=="Redirect" run keywords sleep 1
... AND click element id=security_action_deny ... AND click element id=proxyManipulationdeny
... ELSE log 不修改 ... ELSE IF "${InitializeAction}"=="Replace" run keywords sleep 1
... AND click element id=proxyManipulationdeny
... ELSE IF "${InitializeAction}"=="Hijack" run keywords sleep 1
... AND click element id=proxyManipulationdeny
... ELSE IF "${InitializeAction}"=="Insert" run keywords sleep 1
... AND click element id=proxyManipulationdeny
... ELSE log 不修改
sleep 1 sleep 1
${status} Run Keyword And Return Status Page should contain element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[4]/div[1]/div/div/div #判断页面是否包含该元素 ${status} Run Keyword And Return Status Page should contain element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[4]/div[1]/div/div/div #判断页面是否包含该元素
run keyword if "${status}"=="False" log go on run keyword if "${status}"=="False" log go on
@@ -949,4 +895,53 @@ Initialize-Policie
... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div/p/span/span/i[2] ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div/p/span/span/i[2]
... AND sleep 1 ... AND sleep 1
Delete-Proxy
[Arguments] ${securityname}
Menu policys Security Policy
sleep 2
Wait Until Element Is Enabled xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div 10
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div
sleep 1
click element xpath=/html/body/div/div[1]/div[1]/ul/li[3]
sleep 1
input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${securityname}
sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i
sleep 1
Run Keyword And Ignore Error click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]
sleep 2
sleep 1
Run Keyword And Ignore Error click element id=appDel
sleep 1
Run Keyword And Ignore Error click element xpath=/html/body/div/div/div[3]/button[2]
sleep 1
Delete-object
[Arguments] ${obj}
FOR ${num} ${key} IN ENUMERATE @{obj}
Forname ${obj}[${key}] ${key}
END
Forname
[Arguments] ${objectname} ${key}
FOR ${i} IN @{objectname}
Menu objects ${key}
sleep 2
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div/div/input #点击输入框
sleep 2
click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] #点击name为搜索类型
sleep 2
input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${i} #输入搜索内容
sleep 2
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i #点击搜索按钮
sleep 2
Run Keyword And Ignore Error click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[1]/div/div/span #选择搜索到的列表
sleep 2
sleep 1
Run Keyword And Ignore Error click element id=objectDel #点击删除按钮
sleep 1
Run Keyword And Ignore Error click element xpath=/html/body/div/div/div[3]/button[2]
sleep 1
END

View File

@@ -1,7 +1,7 @@
*** Settings *** *** Settings ***
Library Selenium2Library Library Selenium2Library
Resource ../objects/NewObject.robot Resource ../objects/NewObject.robot
Resource ../Menu.robot
*** Keywords *** *** Keywords ***
CreateButton CreateButton
[Documentation] 点击安全策略中的Create按钮 [Documentation] 点击安全策略中的Create按钮
@@ -37,9 +37,9 @@ Create-Source-Button
Create-Destination-Button Create-Destination-Button
[Documentation] 点击Destination的加号 [Documentation] 点击Destination的加号
Wait Until Element Is Enabled xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[1]/div/div 10
sleep 2 sleep 2
click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[1]/div/div click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[1]/div/div
sleep 2
Create-Application-Button Create-Application-Button
[Documentation] 点击Application的加号 [Documentation] 点击Application的加号
Wait Until Element Is Enabled id=interceptionadd_application 10 Wait Until Element Is Enabled id=interceptionadd_application 10
@@ -965,4 +965,64 @@ Initialize-Policie
... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div/p/span/span/i[2] ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div/p/span/span/i[2]
... AND sleep 1 ... AND sleep 1
Delete-Security-estimate
[Arguments] ${securityname}
run keyword if "${securityname}"!="null" run keywords sleep 1
... AND Delete-Security ${securityname}
... ELSE log go on
Delete-Security
[Arguments] ${securityname}
Menu policys Security Policy
sleep 2
Wait Until Element Is Enabled xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div 10
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div
sleep 1
click element xpath=/html/body/div/div[1]/div[1]/ul/li[3]
sleep 1
input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${securityname}
sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i
sleep 1
Run Keyword And Ignore Error click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]
sleep 2
sleep 1
Run Keyword And Ignore Error click element id=appDel
sleep 1
Run Keyword And Ignore Error click element xpath=/html/body/div/div/div[3]/button[2]
sleep 1
Delete-object-estimate
[Arguments] ${obj}
run keyword if "${obj}"!="null" run keywords sleep 1
... AND Delete-object ${obj}
... ELSE log go on
Delete-object
[Arguments] ${obj}
FOR ${num} ${key} IN ENUMERATE @{obj}
Forname ${obj}[${key}] ${key}
END
Forname
[Arguments] ${objectname} ${key}
FOR ${i} IN @{objectname}
Menu objects ${key}
sleep 2
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div/div/input #点击输入框
sleep 2
click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] #点击name为搜索类型
sleep 2
input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${i} #输入搜索内容
sleep 2
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i #点击搜索按钮
sleep 2
Run Keyword And Ignore Error click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[1]/div/div/span #选择搜索到的列表
sleep 2
sleep 1
Run Keyword And Ignore Error click element id=objectDel #点击删除按钮
sleep 1
Run Keyword And Ignore Error click element xpath=/html/body/div/div/div[3]/button[2]
sleep 1
END