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
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 "${ParametersNumber}"=="Search" run keywords sleep 1
... AND input text xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ${ProfileName}
run keyword if "${len}"!="1" run keywords sleep 1
... AND clcik element id=replaceadd_btn
... AND sleep 1
END
sleep 1
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 press keys xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ENTER
... AND sleep 1
@@ -253,253 +330,116 @@ Replace-Action-Parameters
... 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 sleep 1
... AND HijackFile-Create ${Hijackname} ${Hijackfile} ${dow_name} ${input} ${Hijackname} ${Hijacktype}
... ELSE log 传入参数错误
Intercept-SSL-Keyring-SearchorCreate
[Arguments] ${KeySearchorCreate} ${keyname} ${file}=null ${file1}=null ${ExpiryHours1or2}=null ${type}=null ${type1}=null
... ${shift}=close ${PrivateKeyType}=PrivateKeyFile
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${KeySearchorCreate}:填入Create或Search
... ${name}:新建页面name输入框里的内容
... ${file}:上传文件所在本地的路径
... ${file1}:上传文件所在本地的路径
... ${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}:私钥类型
HijackFile-Create
[Arguments] ${Hijackname} ${Hijackfile} ${dow_name} ${input} ${Hijackname} ${Hijacktype}
[Documentation] 调用次关键字前需要添加必填参数:
... ${Hijackname}:填入新建hijack的name
... ${Hijackfile}:填入新建hijack文件的路径
... ${dow_name}:根据情况填入close或open或其他
... ${input}填入shuru或其他
... ${Hijacktype}:填入选择文件类型的元素
... 新建hijack
Sleep 2
input id=keyringsadd_name ${name} #输入name
input id=hijack_profileName ${Hijackname} #输入name
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
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} #上传文件
${select} Set Variable ${ExpiryHours1or2}
Run Keyword If '${select}'=='1' click element id=keyringsadd_customized
Run Keyword If '${select}'=='1' input text id=reissueExpiryDate 10
run keyword if "${dow_name}"=="close" and "${input}"=="shuru" run keywords sleep 1
... AND input text id=hijack_contentName ${Hijackname}
... ELSE IF "${dow_name}"=="open" click element xpath=//*[@id="contentNameChoose"]/div[1]/span[2]
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 #点击下拉框
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
click element id=hijackAddContentType #点击+ 打开侧滑窗口
Sleep 1
input id=trafficmirror_addrArray0 ${shuru}
click element ${Hijacktype} #选择文件类型
sleep 2
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] #点击OK
DecryptionProfile-SearchorCreate
[Arguments] ${DecryptionProfileSearchorCreate}=null ${DecryptionProfilename}=null ${dict1}=null ${fail1}=null ${min1}=null ${max1}=null
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${DecryptionProfileSearchorCreate}填入Create或Search
... ${DecryptionProfilename}:文件name
... ${dict1}:是个字典等于1为开启等于0为关闭例如Common Name=1 Issuer=1 Self-signed=1 Expiry Date=1 EV Certificat=1
... Certificate Transparency=1 Mutual Authentication=1 On Protocol Errors=1 Certificate Pinning=1 Certificate Not Installed=1 Mirror Client Versions=1
... Allow HTTP/2=1
... ${fail1} :输入Fail-close或Pass-through
... ${min1}:输入协议版本,
... ${max1}:输入协议版本,
click element id=hijackAddOk1 #点击OK
InsertScript-SearchorCreate
[Arguments] ${SearchorCreate} ${Insertname} ${Insertfile} ${Inserttype} ${Insertjstype}
[Documentation] 调用次关键字前需要添加必填参数:
... ${SearchorCreate}:填入Search或Create
... ${Insertname}:填入新建insert的name
... ${Insertfile}:填入新建insert文件的路径
... ${Inserttype}:根据情况填入css或js
... ${Insertjstype}填入Before Page Load或After Page Load
... 判断是新建还是搜索insert
sleep 1
click element id=interceptionadd_eventkeying
click element id=manipulation_select_insetScript
sleep 1
run keyword if "${DecryptionProfileSearchorCreate}"=="Create" run keywords sleep 1
... AND click element id=interceptionadd_decryptionProfileId
... AND sleep 2
... AND Create-DecryptionProfile ${DecryptionProfilename} ${dict1} ${fail1} ${min1} ${max1}
run keyword if "${DecryptionProfileSearchorCreate}"=="Search" run keywords sleep 1
... AND input text id=card_keyringName ${DecryptionProfilename}
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 press keys id=card_keyringName ENTER
... AND press keys xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ENTER
... AND sleep 1
... AND clcik element xpath=//*[@id="decryptionProfileList"]/following-sibling::li[2]
Create-DecryptionProfile
[Arguments] ${name} ${dict1} ${fail1} ${min1} ${max1}
Sleep 1
input id=insert_profileName ${name}
Sleep 1
DecryptionProfileButtonSwitch ${dict1} //*[@id="policy_Manipulation_create8"]/div[2]/form/div/div/label[contains(text(), " ")]/following-sibling::div/div el-switch is-checked el-switch
${fail} Set Variable ${fail1}
run keyword if "${fail}"=="Fail-close" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div[5]/div/div/label[1]/span
... ELSE IF "${fail}"=="Pass-through" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div[5]/div/div/label[2]/span
... ELSE log 1111
${min} Set Variable ${min1}
${max} Set Variable ${max1}
run keyword if "${min}"=="TLSv1.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 click element xpath=/html/body/div/div[1]/div[1]/ul/div[2]/div/li[1]
... AND sleep 1
... AND click id=pro_min1
... ELSE IF "${min}"=="TLSv1.1" Run Keywords sleep 1
... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i
... 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 sleep 1
... AND click id=pro_min2
... ELSE IF "${min}"=="TLSv1.2" 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 InsertScript-Create ${Insertname} ${Insertfile} ${Inserttype} ${Insertjstype}
... ELSE log 传入参数错误
InsertScript-Create
[Arguments] ${Insertname} ${Insertfile} ${Inserttype} ${Insertjstype}
[Documentation] 调用次关键字前需要添加必填参数:
... ${Insertname}:填入新建insert的name
... ${Insertfile}:填入新建insert文件的路径
... ${Inserttype}:根据情况填入css或js
... ${Insertjstype}填入Before Page Load或After Page Load
... 新建insert
Sleep 2
input id=insert_profileName ${Insertname} #输入name
Sleep 2
Choose File xpath=//*[@id="insertAddUpload"]/div[1]/input ${Insertfile} #上传文件
Sleep 2
clcik element id=insert_select_format
sleep 1
run keyword if "${Inserttype}"=="css" run keywords sleep 1
... AND click element //span[.="${Inserttype}"] #选择css
run keyword if "${Inserttype}"=="js" run keywords sleep 1
... AND click element //span[.="${Inserttype}"]
... AND sleep 1
... AND click id=pro_min3
... 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 click element id=insert_select_insertOn #点击下拉框
... 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 错误
... AND click element //span[.="${Insertjstype}"]
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}
click element id=insertAddOk1 #点击OK
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
[Arguments] ${LogSession}
[Documentation] 调用次关键字前需要添加必填参数:
... ${LogSession}:填入clcos或其他
run keyword if "${LogSession}"=="close" run keywords sleep 1
... AND click element id=addlabel_labels_log
... AND click element id=manipulationSwitch0
... 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
[Arguments] ${Enabled}
[Documentation] 调用次关键字前需要添加必填参数:
... ${Enabled}:填入open或其他
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 click element xpath=/html/body/div/div/div[3]/button[2]
... ELSE log 开启日志
Security-Policies-OK
sleep 1
click element id=interceptionadd_sub
click element id=proxyManipulationSuccess
sleep 1
Create-Object-Search
[Arguments] ${name} ${filter}
[Documentation] 调用次关键字前需要添加必填参数:
@@ -899,7 +839,7 @@ 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]
Security-Source
Proxy-Source
[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
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div
@@ -928,14 +868,20 @@ Initialize-Policie
[Documentation] 调用次关键字前需要添加必填参数:
... ${InitializeAction}:根据用例进行填写意思就是是那一个action就不要点击哪一个以免初始化失败
run keyword if "${InitializeAction}"=="Allow" run keywords sleep 1
... AND click element id=security_action_deny
... AND click element id=proxyManipulationdeny
... AND 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
... AND click element id=security_action_deny
... ELSE IF "${InitializeAction}"=="Intercept" run keywords sleep 1
... AND click element id=security_action_deny
... AND click element id=proxyManipulationdeny
... ELSE IF "${InitializeAction}"=="Redirect" run keywords sleep 1
... AND click element id=proxyManipulationdeny
... 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
${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 #判断页面是否包含该元素
@@ -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 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 ***
Library Selenium2Library
Resource ../objects/NewObject.robot
Resource ../Menu.robot
*** Keywords ***
CreateButton
[Documentation] 点击安全策略中的Create按钮
@@ -37,9 +37,9 @@ Create-Source-Button
Create-Destination-Button
[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
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
[Documentation] 点击Application的加号
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 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