diff --git a/02-Keyword/tsg_ui/ProxyWANNAT.robot/ProxyWANNAT.robot b/02-Keyword/tsg_ui/ProxyWANNAT.robot/ProxyWANNAT.robot new file mode 100644 index 0000000..2e1384c --- /dev/null +++ b/02-Keyword/tsg_ui/ProxyWANNAT.robot/ProxyWANNAT.robot @@ -0,0 +1,834 @@ +*** Settings *** +Library Selenium2Library +Resource ../Menu.robot +#Resource ../SecurityPolicy/SourceAndDestination.robot +Resource ../objects/NewObject.robot + +*** Keywords *** +UIAddWANNAT + [Arguments] ${TCPProxy} ${TCPClientDict} ${TCPServerDict} ${SourceInfo}=null ${DestinationInfo}=null ${FilterInfo}=null + ${return} ${Tcpname} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} Tcpname + ${Tcpname} Run Keyword If "${return}"=="FAIL" or "${Tcpname}"=="${EMPTY}" set variable null + ... ELSE set variable ${Tcpname} + + ${return} ${EnableTCPPassthrough} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} EnableTCPPassthrough + ${EnableTCPPassthrough} Run Keyword If "${return}"=="FAIL" or "${EnableTCPPassthrough}}"=="${EMPTY}" set variable null + ... ELSE set variable ${EnableTCPPassthrough} + + ${return} ${BypassDuplicatedPacket} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} BypassDuplicatedPacket + ${BypassDuplicatedPacket} Run Keyword If "${return}"=="FAIL" or "${BypassDuplicatedPacket}}"=="${EMPTY}" set variable null + ... ELSE set variable ${BypassDuplicatedPacket} + + Comment 打开菜单新建策略输入name + Create-Proxy-TCP-Options ${Tcpname} + #Create-Source-Button + Run Keyword If "${SourceInfo}"=="${EMPTY}" or "${SourceInfo}"=="null" log there is no SourceInfoDict + ... ELSE Create-Source-Button + Run Keyword If "${SourceInfo}"=="${EMPTY}" or "${SourceInfo}"=="null" log there is no SourceInfoDict + ... ELSE CreateEditDeleteSources ${SourceInfo} + + Run Keyword If "${DestinationInfo}"=="${EMPTY}" or "${DestinationInfo}"=="null" log there is no DestinationInfo + ... ELSE Create-Destination-Button + Run Keyword If "${DestinationInfo}"=="${EMPTY}" or "${DestinationInfo}"=="null" log there is no DestinationInfo + ... ELSE CreateEditDeleteDestination ${DestinationInfo} + Run Keyword If "${FilterInfo}"=="${EMPTY}" log there is no FilterInfo + ... ELSE Filter-create ${FilterInfo} + Run Keyword If "${EnableTCPPassthrough}"=="${EMPTY}" or "${EnableTCPPassthrough}"=="null" log there is no EnableTCPPassthrough + ... ELSE TCP-Enable-TCP-Passthrough ${EnableTCPPassthrough} + Run Keyword If "${BypassDuplicatedPacket}"=="${EMPTY}" or "${BypassDuplicatedPacket}"=="null" log there is no BypassDuplicatedPacket + ... ELSE TCP-Bypass-Duplicated-Packet ${BypassDuplicatedPacket} + TCP-Client-side-Parameters ${TCPClientDict} + TCP-Server-side-Parameters ${TCPServerDict} + TCP-OK + TCP-Assertion ${Tcpname} + +UIUpdateWANNAT + [Arguments] ${TCPProxy} ${TCPClientDict} ${TCPServerDict} ${SourceInfo}=null ${DestinationInfo}=null ${FilterInfo}=null + ${return} ${Tcpname} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} Tcpname + ${Tcpname} Run Keyword If "${return}"=="FAIL" or "${Tcpname}"=="${EMPTY}" set variable null + ... ELSE set variable ${Tcpname} + + ${return} ${Edittcpname} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} Edittcpname + ${Edittcpname} Run Keyword If "${return}"=="FAIL" or "${Edittcpname}"=="${EMPTY}" set variable ${Tcpname} + ... ELSE set variable ${Edittcpname} + + ${return} ${EnableTCPPassthrough} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} EnableTCPPassthrough + ${EnableTCPPassthrough} Run Keyword If "${return}"=="FAIL" or "${EnableTCPPassthrough}}"=="${EMPTY}" set variable null + ... ELSE set variable ${EnableTCPPassthrough} + + ${return} ${BypassDuplicatedPacket} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} BypassDuplicatedPacket + ${BypassDuplicatedPacket} Run Keyword If "${return}"=="FAIL" or "${BypassDuplicatedPacket}}"=="${EMPTY}" set variable null + ... ELSE set variable ${BypassDuplicatedPacket} + Edit-Proxy-TCP-Options ${Tcpname} + Run Keyword If "${Edittcpname}"=="${EMPTY}" or "${Edittcpname}"=="null" log there is no Edittcpname + ... ELSE Edit-Proxy-TCP-Name ${Edittcpname} + Run Keyword If "${SourceInfo}"=="${EMPTY}" or "${SourceInfo}"=="null" log there is no SourceInfoDict + ... ELSE Create-Source-Button + Run Keyword If "${SourceInfo}"=="${EMPTY}" or "${SourceInfo}"=="null" log there is no SourceInfoDict + ... ELSE CreateEditDeleteSources ${SourceInfo} + Run Keyword If "${DestinationInfo}"=="${EMPTY}" or "${DestinationInfo}"=="null" log there is no DestinationInfo + ... ELSE Create-Destination-Button + Run Keyword If "${DestinationInfo}"=="${EMPTY}" or "${DestinationInfo}"=="null" log there is no DestinationInfo + ... ELSE CreateEditDeleteDestination ${DestinationInfo} + Run Keyword If "${FilterInfo}"=="${EMPTY}" log there is no FilterInfo + ... ELSE Filter-create ${FilterInfo} + Run Keyword If "${EnableTCPPassthrough}"=="${EMPTY}" or "${EnableTCPPassthrough}"=="null" log there is no EnableTCPPassthrough + ... ELSE TCP-Enable-TCP-Passthrough ${EnableTCPPassthrough} + Run Keyword If "${BypassDuplicatedPacket}"=="${EMPTY}" or "${BypassDuplicatedPacket}"=="null" log there is no BypassDuplicatedPacket + ... ELSE TCP-Bypass-Duplicated-Packet ${BypassDuplicatedPacket} + TCP-Client-side-Parameters ${TCPClientDict} + TCP-Server-side-Parameters ${TCPServerDict} + TCP-OK + TCP-Assertion ${Edittcpname} + + + +Create-WANNAT + [Arguments] ${Wannatname} + sleep ${sleep} + Menu policys WAN NAT + sleep ${sleep} + click element id=app_create #点击Create按钮 + sleep ${sleep} + input text id=WANNATADD_name1 ${Wannatname} #输入name + sleep ${sleep} + +Edit-WANNAT + [Arguments] ${Wannatname} + sleep ${sleep} + Menu policys WAN NAT + sleep ${sleep} + Proxy-TCP-Options-Search ${Wannatname} Name #搜索策略 + sleep ${sleep} + click element id=appEdit #点击Edit按钮 + sleep ${sleep} + +Edit-Proxy-TCP-Name + [Arguments] ${Edittcpname} + input text id=advancedAdd_policyName ${Edittcpname} #输入name + +Wannat-Action + [Arguments] ${WannatAction} + Run Keyword If "${WannatAction}"=="SNAT" run keywords sleep ${sleep} + ... AND click element id=WANNAT_action_SNAT #点击SNAT按钮 + ... ELSE IF "${WannatAction}"=="DNAT" click element id=WANNAT_action_DNAT #点击DNAT按钮 + ... ELSE log 不操作 + +Wannat-AccessMode + [Arguments] ${WannatAccessMode} + Run Keyword If "${WannatAccessMode}"=="VPN" run keywords sleep ${sleep} + ... AND click element id=WANNAT_accessMode_VPN #点击VPN按钮 + ... ELSE IF "${WannatAccessMode}"=="Layer2" click element id=WANNAT_accessMode_Layer2 #点击Layer2按钮 + ... ELSE log 不操作 + +Wannat-OriginalPacket + [Arguments] ${WannatAction} ${WannatAccessMode} ${VPNAccountDict} ${SourceInfo} ${DestinationInfo} + Run Keyword If "${WannatAction}"=="SNAT" and "${WannatAccessMode}"=="VPN" run keywords sleep ${sleep} + ... AND Wannat-VPNAccount ${VPNAccountDict} #添加vpnaccount + Run Keyword If "${WannatAction}"=="SNAT" and "${WannatAccessMode}"=="Layer2" run keywords sleep ${sleep} + ... AND input text xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]/div/div/input ${PrivateNetworkAddress} + ... AND sleep ${sleep} + Run Keyword If "${WannatAction}"=="DNAT" and "${WannatAccessMode}"=="VPN" run keywords sleep ${sleep} + ... AND Create-Source-Button ${SourceInfo} #是否添加源ip + ... AND Create-Destination-Button ${DestinationInfo} #是否添加目的ip + Run Keyword If "${WannatAction}"=="DNAT" and "${WannatAccessMode}"=="Layer2" run keywords sleep ${sleep} + ... AND Create-Source-Button ${SourceInfo} #是否添加源ip + ... AND Create-Destination-Button ${DestinationInfo} #是否添加目的ip + + +Wannat-VPNAccount + [Arguments] ${VPNAccountDict} + ${return} ${CreateOrSearch} Run Keyword And Ignore Error Get From Dictionary ${VPNAccountDict} CreateOrSearch + ${CreateOrSearch} Run Keyword If "${return}"=="FAIL" or "${CreateOrSearch}"=="${EMPTY}" set variable Create + ... ELSE set variable ${CreateOrSearch} + + ${return} ${VPNAccountName} Run Keyword And Ignore Error Get From Dictionary ${VPNAccountDict} VPNAccountName + ${VPNAccountName} Run Keyword If "${return}"=="FAIL" or "${VPNAccountName}"=="${EMPTY}" set variable VPNAccountName + ... ELSE set variable ${VPNAccountName} + + ${return} ${VPNAccountPassword} Run Keyword And Ignore Error Get From Dictionary ${VPNAccountDict} VPNAccountPassword + ${VPNAccountPassword} Run Keyword If "${return}"=="FAIL" or "${VPNAccountPassword}"=="${EMPTY}" set variable Password + ... ELSE set variable ${VPNAccountPassword} + + + click element id=wannat_vpn #点击VPN Account 加号按钮 + sleep ${sleep} + Run Keyword If "${CreateOrSearch}"=="Create" run keywords sleep ${sleep} + ... AND click element xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]/div[2]/div[2]/div/div/div/div/button #点击VPN Account 加号按钮 + ... AND sleep ${sleep} + ... AND input text xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]/div[3]/div/div[2]/div/div[2]/div/div/div/from/div[2]/div/div/div/input ${VPNAccountName} #输入vpn的name + ... AND sleep ${sleep} + ... AND input text xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]/div[3]/div/div[2]/div/div[2]/div/div/div/from/div[3]/div/div/input ${VPNAccountPassword} #输入vpn的password + ... AND sleep ${sleep} + ... AND click element xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]/div[3]/div/div[3]/button #点击OK + ... AND sleep ${sleep} + ... AND click element xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]/div[2]/div[2]/div[3]/div/button #点击close + ... AND sleep ${sleep} + ... ELSE IF "${CreateOrSearch}"=="Search" sleep ${sleep} + ... AND input text xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]div[2]/div[2]/div/div/div/input ${VPNAccountName} #输入vpn的name + ... AND sleep ${sleep} + ... AND press keys xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]div[2]/div[2]/div/div/div/input ENTER + ... AND sleep ${sleep} + ... AND click element xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]div[2]/div[2]/div/div/div[3]/div/div/ul/li + ... AND sleep ${sleep} + ... AND click element xpath=//*[@id="policy_paper_left"]/div[5]/form/div[1][contains(text(), "Original Packet")]/following-sibling::div[2]/div[2]/div[2]/div[3]/div/button #点击close + ... ELSE log 不操作 + +Create-Source-Button + [Arguments] ${SourceInfo} + Run Keyword If "${SourceInfo}"!="${EMPTY}" or "${SourceInfo}"!="null" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[6]/div[2]/div[1]/div/div #点击添加源ip + ... AND sleep ${sleep} + ... AND CreateEditDeleteSources ${SourceInfo} + ... ELSE log there is no SourceInfo + + + +Create-Destination-Button + [Arguments] ${DestinationInfo} + Run Keyword If "${DestinationInfo}"!="${EMPTY}" or "${DestinationInfo}"!="null" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[6]/div[2]/div[1]/div/div #点击添加源ip + ... AND sleep ${sleep} + ... AND CreateEditDeleteSources ${SourceInfo} + ... ELSE log there is no DestinationInfo + + +CreateEditDeleteSources + [Arguments] ${SourceInfoDict} + [Documentation] 策略源条件处理、包括增加:create、search,update、delete几个列表; + ... 格式:新增:Type1=IP option=Create Add=Address name=zdhip001 Ipclienttext1=192.168.100.1 Port=1 + ... 修改:Type1=IP option=Update Add=Address name=zdhip001 Ipclienttext1=192.168.100.1 Port=1 把为name对应值的的记录修改为输入的内容 + ... 新增:Type1=Geography option=Create Add=Address name=zdhip001 Ipclienttext1=192.168.100.1 Port=1geo + ${return} ${AddList} Run Keyword And Ignore Error Get From Dictionary ${SourceInfoDict} sourceAddIpList + Run Keyword If "${return}"=="FAIL" or "${AddList}"=="${EMPTY}" log there is no CreateSource + ... ELSE CreateSources1 ${AddList} + +CreateSources1 + [Arguments] ${AddList} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Type1}:填入Ip或SUBID或Geography或IPLearning + ... ${CreateOrSearch}:填入Create或者Search + ... ${Add}:填入Address或Group + ... ${Name}:名称 + ... ${Ip_type}:填入Ip或者Geography或者IPLearning + ... ${Ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${Port}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${Times}:填入小时数,例如1或2 + ... ${Numbers}:填入数值,例如1或10000 + ... ${Limits}:填入数值,例如1或10000 + ... ${ObjectName}:列表形式,列表中是对象的名字 + ... ${Keywordtext}:填入新建subid的内容 + ... 判断新建source选择用什么样的类型数据 + ${listlenth}= Get Length ${AddList} + #${tempValue} set Variable tempValue + #FOR ${var} IN RANGE ${AddList} + FOR ${var} IN RANGE ${listlenth} + log ${var} + ${tempValue} Get From List ${AddList} ${var} + CreateSource ${tempValue} + END + + +CreateSource + [Arguments] ${AddDict} + #[Arguments] ${PolicyType}=null ${Type1}=null ${CreateOrSearch}=null ${Add}=null ${Name}=null + #... ${ObjectName}=null ${Ipclienttext1}=null ${Port}=null ${Country}=null ${City}=null + #... ${Protocols1}=null ${Degree}=null ${Times}=null ${Numbers}=null ${Limits}=null ${Keywordtext}=null + [Documentation] 调用次关键字前需要添加必填参数: + ... ${PolicyType}:填入安全策略或管控策略或tcp策略中前置元素:安全和代理源:/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4] 安全和代理目的:/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5] + ... tcp源:/html/body/div[1]/div/div[3]/div[2]/div/div/div[1]/div[1]/div/div[2]/form/div[2] + ... tcp目的:/html/body/div[1]/div/div[3]/div[2]/div/div/div[1]/div[1]/div/div[2]/form/div[3] + ... ${Type1}:填入Ip或SUBID或Geography或IPLearning + ... ${CreateOrSearch}:填入Create或者Search + ... ${Add}:填入Address或Group + ... ${Name}:名称 + ... ${Ip_type}:填入Ip或者Geography或者IPLearning + ... ${Ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${Port}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${Times}:填入小时数,例如1或2 + ... ${Numbers}:填入数值,例如1或10000 + ... ${Limits}:填入数值,例如1或10000 + ... ${ObjectName}:列表形式,列表中是对象的名字 + ... ${Keywordtext}:填入新建subid的内容 + ... 判断新建source选择用什么样的类型数据 + #调用次关键字前需要添加必填参数: + ${return} ${Sordtype} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Sordtype + ${Sordtype} Run Keyword If "${return}"=="FAIL" or "${Sordtype}"=="${EMPTY}" set variable Source + ... ELSE set variable ${Sordtype} + ${typepath} Run Keyword If "${Sordtype}"=="Source" set variable /html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[6]/div[2] + ... ELSE set variable /html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[6]/div[3] + + ${return} ${Type1} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Type1 + ${Type1} Run Keyword If "${return}"=="FAIL" or "${Type1}"=="${EMPTY}" set variable IP + ... ELSE set variable ${Type1} + ${return} ${CreateOrSearch} Run Keyword And Ignore Error Get From Dictionary ${AddDict} CreateOrSearch + ${CreateOrSearch} Run Keyword If "${return}"=="FAIL" or "${CreateOrSearch}"=="${EMPTY}" set variable Create + ... ELSE set variable ${CreateOrSearch} + ${return} ${Add} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Add + ${Add} Run Keyword If "${return}"=="FAIL" or "${Add}"=="${EMPTY}" set variable Add + ... ELSE set variable ${Add} + ${return} ${ObjectName} Run Keyword And Ignore Error Get From Dictionary ${AddDict} ObjectName + ${ObjectName} Run Keyword If "${return}"=="FAIL" or "${ObjectName}"=="${EMPTY}" set variable null + ... ELSE set variable ${ObjectName} + ${return} ${Name} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Name + ${Name} Run Keyword If "${return}"=="FAIL" or "${Name}"=="${EMPTY}" set variable null + ... ELSE set variable ${Name} + ${return} ${Ipclienttext1} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Ipclienttext1 + ${Ipclienttext1} Run Keyword If "${return}"=="FAIL" or "${Ipclienttext1}"=="${EMPTY}" set variable null + ... ELSE set variable ${Ipclienttext1} + ${return} ${Port} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Port + ${Port} Run Keyword If "${return}"=="FAIL" or "${Port}"=="${EMPTY}" set variable null + ... ELSE set variable ${Port} + ${return} ${Country} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Country + ${Country} Run Keyword If "${return}"=="FAIL" or "${Country}"=="${EMPTY}" set variable null + ... ELSE set variable ${Country} + ${return} ${City} Run Keyword And Ignore Error Get From Dictionary ${AddDict} City + ${City} Run Keyword If "${return}"=="FAIL" or "${City}"=="${EMPTY}" set variable null + ... ELSE set variable ${City} + ${return} ${Fqdn} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Fqdn + ${Fqdn} Run Keyword If "${return}"=="FAIL" or "${Fqdn}"=="${EMPTY}" set variable null + ... ELSE set variable ${Fqdn} + ${return} ${Protocols1} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Protocols1 + ${Protocols1} Run Keyword If "${return}"=="FAIL" or "${Protocols1}"=="${EMPTY}" set variable null + ... ELSE set variable ${Protocols1} + ${return} ${Degree} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Degree + ${Degree} Run Keyword If "${return}"=="FAIL" or "${Degree}"=="${EMPTY}" set variable null + ... ELSE set variable ${Degree} + ${return} ${Times} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Times + ${Times} Run Keyword If "${return}"=="FAIL" or "${Times}"=="${EMPTY}" set variable null + ... ELSE set variable ${Times} + ${return} ${Numbers} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Numbers + ${Numbers} Run Keyword If "${return}"=="FAIL" or "${Numbers}"=="${EMPTY}" set variable null + ... ELSE set variable ${Numbers} + ${return} ${Limits} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Limits + ${Limits} Run Keyword If "${return}"=="FAIL" or "${Limits}"=="${EMPTY}" set variable null + ... ELSE set variable ${Limits} + + sleep ${sleep} + SourceIPCreateOrSearch ${Sordtype} ${typepath} ${CreateOrSearch} ${Add} ${Type1} ${Name} ${ObjectName} ${Ipclienttext1} ${Port} ${Country} ${City} ${Fqdn} ${Protocols1} ${Degree} ${Times} ${Numbers} ${Limits} + + +SourceIPCreateOrSearch + [Arguments] ${Sordtype} ${PolicyType} ${CreateOrSearch} ${Add} ${Ip_type} ${Name} ${ObjectName} ${Ipclienttext1} + ... ${Port} ${Country} ${City} ${Fqdn} ${Protocols1} ${Degree} ${Times} ${Numbers} ${Limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${CreateOrSearch}:填入Create或者Search + ... ${Add}:填入Address或Group + ... ${Name}:名称 + ... ${Ip_type}:填入Ip或者Geography或者IPLearning + ... ${Ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${Port}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${Times}:填入小时数,例如1或2 + ... ${Numbers}:填入数值,例如1或10000 + ... ${Limits}:填入数值,例如1或10000 + ... ${ObjectName}:列表形式,列表中是对象的名字 + ... 判断是新建ip还是搜索添加ip + run keyword if "${CreateOrSearch}"=="Create" run keywords sleep ${sleep} + ... AND SourceOrDestination ${Sordtype} + ... AND SourceIPAdd ${PolicyType} ${Add} ${Ip_type} ${Name} ${ObjectName} ${Ipclienttext1} ${Port} ${Country} ${City} ${Fqdn} ${Protocols1} ${Degree} ${Times} ${Numbers} ${Limits} + ... ELSE IF "${CreateOrSearch}"=="Search" run keywords sleep ${sleep} + ... AND SourceSearch ${PolicyType} ${ObjectName} + +SourceOrDestination + [Arguments] ${Sordtype} + run keyword if "${Sordtype}"=="Source" run keywords sleep ${sleep} + ... AND click element id=interceptionadd_proaddaddSource + ... ELSE click element id=interceptionadd_proaddaddDestination +SourceSearch + [Arguments] ${PolicyType} ${Name} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Name}:填入是一个列表,列表内容为source的name + ... 选择search对象 + FOR ${i} IN @{name} + input text xpath=${PolicyType}/div[2]/div[1]/div[2]/div[2]/div/div[1]/input ${i} + sleep ${sleep} + press keys xpath=${PolicyType}/div[2]/div[1]/div[2]/div[2]/div/div[1]/input ENTER + sleep ${sleep} + click element xpath=${PolicyType}/div[2]/div[1]/div[2]/div[2]/div/div[2]/div/div/ul/li[1] + sleep ${sleep} + END + + + +SourceIPAdd + [Arguments] ${PolicyType} ${Add} ${Ip_type} ${Name} ${ObjectName} ${Ipclienttext1} ${Port} ${Country} ${City} ${Fqdn} ${Protocols1} ${Degree} ${Times} ${Numbers} ${Limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Add}:填入Address或Group + ... ${Ip_type}:填入IP或者Geography或者IPLearning + ... 判断是新建ip还是新建ip分组 + run keyword if "${Add}"=="Address" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/ul/li[1] + ... AND sleep ${sleep} + ... AND SourceIPAddress ${PolicyType} ${Name} ${Ip_type} ${Ipclienttext1} ${Port} ${Country} ${City} ${Fqdn} ${Protocols1} ${Degree} ${Times} ${Numbers} ${Limits} + ... ELSE IF "${Add}"=="Group" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/ul/li[2] + ... AND sleep ${sleep} + ... AND SourceIPGroupAdd ${PolicyType} ${Name} ${Ip_type} ${ObjectName} +SourceIPAddress + [Arguments] ${PolicyType} ${Name} ${Ip_type} ${Ipclienttext1} ${Port} ${Country} ${City} ${Fqdn} ${Protocols1} ${Degree} ${Times} ${Numbers} ${Limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Name}:名称 + ... ${Ip_type}:填入Ip或者Geography或者IPLearning + ... ${Ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${Port}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${Times}:填入小时数,例如1或2 + ... ${Numbers}:填入数值,例如1或10000 + ... ${Limits}:填入数值,例如1或10000 + ... 判断 新建选择用什么样的类型,并进行新建 + SourceCreate-name ${PolicyType} ${Name} + sleep ${sleep} + run keyword if "${Ip_type}"=="Ip" run keywords click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[1] + ... AND sleep ${sleep} + ... AND NewObject.Create-ip-ClientIP-text ${Ipclienttext1} ${Port} + run keyword if "${Ip_type}"=="Geography" run keywords click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[3]/div/div/label[2] + ... AND sleep ${sleep} + ... AND click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[1]/div[2] + ... AND sleep ${sleep} + ... AND NewObject.Create-Geography ${Country} ${City} + ... AND sleep ${sleep} + ... AND click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[10]/div/div/div/div[4]/button + ... AND sleep ${sleep} + run keyword if "${Ip_type}"=="IPLearning" run keywords click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[3]/div/div/label[3] + ... AND sleep ${sleep} + ... AND click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[1] + ... AND sleep ${sleep} + ... AND input text xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[3]/div/div[1]/div[2]/div[1]/div[1]/form/div[1]/div/div[1]/input ${Fqdn} + ... AND sleep ${sleep} + ... AND click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[1]/div/div/div[2] + ... AND sleep ${sleep} + ... AND ProxyWANNAT.Learn-From-Protocols ${Protocols1} + ... AND ProxyWANNAT.Learning-Depth ${PolicyType} ${Degree} + ... AND sleep ${sleep} + ... AND input text xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[3]/div/div[1]/input ${Times} + ... AND sleep ${sleep} + ... AND input text xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[4]/div/div[1]/input ${Numbers} + ... AND sleep ${sleep} + ... AND input text xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[5]/div/div[1]/input ${Limits} + ... AND sleep ${sleep} + sleep ${sleep} + SourceCreate-ok ${PolicyType} + + +Learn-From-Protocols + [Arguments] ${Protocols1} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Protocols1}:填入HTTP或SSL或者HTTPSSL + ... 判断选择用什么样的协议 + run keyword if "${Protocols1}"=="HTTP" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[1] + run keyword if "${Protocols1}"=="SSL" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[2] + run keyword if "${Protocols1}"=="HTTPSSL" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[1] + ... AND sleep ${sleep} + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[2] + +Learning-Depth + [Arguments] ${PolicyType} ${Degree} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Degree}:填入1Degree或2Degree + ... 判断是用1Degree或2Degree + run keyword if "${Degree}"=="1Degree" run keywords sleep ${sleep} + ... AND click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[2]/div/div/label[1] + run keyword if "${Degree}"=="2Degree" run keywords sleep ${sleep} + ... AND click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[2]/div/div/label[2] + +SourceIPGroupAdd + [Arguments] ${PolicyType} ${Name} ${Ip_type} ${ObjectName} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Name}:名称 + ... ${Ip_type}:填入Ip或者Geography + ... ${ObjectName}:列表形式,列表中是对象的名字 + SourceCreate-name ${PolicyType} ${Name} + Select-ip_type ${Ip_type} + sleep ${sleep} + click element xpath=${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div/div[2] + Create-Sub-Objects ${ObjectName} + NewObject.Create-ok + +SourceCreate-name + [Arguments] ${PolicyType} ${ObjName} + sleep ${sleep} + input text ${PolicyType}/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[1]/div/div[1]/input ${ObjName} + +SourceCreate-ok + [Arguments] ${PolicyType} + sleep ${sleep} + click button xpath=${PolicyType}/div[2]/div[2]/div/div[2]/button[1] + +WANNAT-IPPools + [Arguments] ${CreateOrSearch} ${CreateOrSearch} ${IPPoolsValue} + sleep ${sleep} + click element id=WANNAT_ipPool #点击ipPool 的加号按钮 + run keyword if "${CreateOrSearch}"=="Create" run keywords sleep ${sleep} + ... AND click element di=WANNAT_proaddadd + ... AND sleep ${sleep} + ... AND input text xpath=//*[@id="wannat_vpn_color"]/form/div[1]/div/div[1]/div[1]/input ${CreateOrSearch} #输入name + ... AND sleep ${sleep} + ... AND IPPoolsFor ${IPPoolsValue} + ... AND sleep ${sleep} + ... AND click element id=wan_reach_test # 点击Reachability Test + ... AND sleep ${sleep} + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div/div[3]/button[1] #点击OK +IPPoolsFor + [Arguments] ${IPPoolsValue} + FOR ${i} IN @{IPPoolsValue} + click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div/div[2]/div/div[2]/div/div/div/form/div[3]/div/div/div[3]/i #点击+号 + sleep ${sleep} + input text xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div/div[2]/div/div[2]/div/div/div/form/div[3]/div/div/div[2]/div[1]/div/div/div[1]/div[1]/div/div[2]/div/input ${i} #输入值 + END + + + + + +Filter-create + [Arguments] ${FilterInfo} + ${return} ${Filtercreate} Run Keyword And Ignore Error Get From Dictionary ${FilterInfo} Filtercreate + ${Filtercreate} Run Keyword If "${return}"=="FAIL" or "${Filtercreate}"=="${EMPTY}" set variable null + ... ELSE set variable ${Filtercreate} + ${return} ${SNIname} Run Keyword And Ignore Error Get From Dictionary ${FilterInfo} SNIname + ${SNIname} Run Keyword If "${return}"=="FAIL" or "${SNIname}"=="${EMPTY}" set variable null + ... ELSE set variable ${SNIname} + FOR ${i} IN @{Filtercreate} + sleep ${sleep} + click element id=interceptionadd_add_filter + sleep ${sleep} + run keyword if "${i}"=="SNI" run keywords sleep ${sleep} + ... AND click element id=interceptionadd_checkappshow0 + ... AND Create-Object-Search ${SNIname} ${i} + ... AND sleep ${sleep} + ${class}= Get Element Attribute xpath=//*[@id="policy_paper_left"]/div[2]/form/div[5]/div[1]/div[1]/label[contains(text(), "${i}")]/following-sibling::div/div class + run keyword if "${class}"=="addobject addobject-long-list float-left" log 不操作 + run keyword if "${class}"=="addobject addobject-long-list float-left obj-content-null" run keywords sleep ${sleep} + ... AND click element xpath=//*[@id="policy_paper_left"]/div[2]/form/div[5]/div[1]/div[1]/label[contains(text(), "${i}")]/following-sibling::div/div[2]/i + END +Create-Object-Search + [Arguments] ${name} ${filter} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:填入是一个列表,列表内容为object的name + ... 选择search对象 + sleep ${sleep} + click element xpath=//*[@id="policy_paper_left"]/div[2]/form/div[5]/div[1]/div[1]/label[contains(text(), "${filter}")]/following-sibling::div/div + sleep ${sleep} + FOR ${i} IN @{name} + input text xpath=//*[@id="condistions_protocol"]/div[2]/p[contains(text(), "${filter}")]/following-sibling::div[2]/div/div[1]/input ${i} + sleep ${sleep} + press keys xpath=//*[@id="condistions_protocol"]/div[2]/p[contains(text(), "${filter}")]/following-sibling::div[2]/div/div[1]/input ENTER + sleep ${sleep} + click element xpath=//*[@id="condistions_protocol"]/div[2]/p[contains(text(), "${filter}")]/following-sibling::div[2]/div/div[2]/div/div/ul/li[1] + sleep ${sleep} + END +TCP-Enable-TCP-Passthrough + [Arguments] ${Enable-TCP-Passthrough} + #判断是否开启Enable TCP Passthrough按钮,${Enable-TCP-Passthrough}=open,为开启,否则不添开启 + run keyword if "${Enable-TCP-Passthrough}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=//*[@id="proxytcpThrough"]/label[contains(text(), "Enable TCP Passthrough")]/following-sibling::div/div #点击Enable-TCP-Passthrough按钮开启 + ... AND sleep ${sleep} + ... ELSE log 不开启 +TCP-Bypass-Duplicated-Packet + [Arguments] ${Bypass-Duplicated-Packet} + #判断是否开启Bypass Duplicated Packet按钮,${Bypass-Duplicated-Packet}=open,为开启,否则不添开启 + run keyword if "${Bypass-Duplicated-Packet}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=//*[@id="proxyduplicatedPacket"]/label[contains(text(), "Bypass Duplicated Packet")]/following-sibling::div/div #点击Bypass-Duplicated-Packet按钮开启 + ... AND sleep ${sleep} + ... ELSE log 不开启 +TCP-Client-side-Parameters + [Arguments] ${TCPClientDict} + + ${Clientelement} set variable /html/body/div[1]/div/div[3]/div[2]/div/div/div[1]/div[1]/div/div[2]/form/div[9]/div[2]/div[1] + + ${return} ${ClientOverrideMSS} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientOverrideMSS + ${ClientOverrideMSS} Run Keyword If "${return}"=="FAIL" or "${ClientOverrideMSS}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientOverrideMSS} + + ${return} ${ClientMSSvalue} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientMSSvalue + ${ClientMSSvalue} Run Keyword If "${return}"=="FAIL" or "${ClientMSSvalue}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientMSSvalue} + + ${return} ${ClientNoDelay} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientNoDelay + ${ClientNoDelay} Run Keyword If "${return}"=="FAIL" or "${ClientNoDelay}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientNoDelay} + + ${return} ${Clientttlvalue} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} Clientttlvalue + ${Clientttlvalue} Run Keyword If "${return}"=="FAIL" or "${Clientttlvalue}"=="${EMPTY}" set variable null + ... ELSE set variable ${Clientttlvalue} + + ${return} ${ClientKeepalive} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientKeepalive + ${ClientKeepalive} Run Keyword If "${return}"=="FAIL" or "${ClientKeepalive}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientKeepalive} + + ${return} ${ClientProbeNumber} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientProbeNumber + ${ClientProbeNumber} Run Keyword If "${return}"=="FAIL" or "${ClientProbeNumber}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientProbeNumber} + + ${return} ${ClientIdleTime} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientIdleTime + ${ClientIdleTime} Run Keyword If "${return}"=="FAIL" or "${ClientIdleTime}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientIdleTime} + + ${return} ${ClientInterval} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientInterval + ${ClientInterval} Run Keyword If "${return}"=="FAIL" or "${ClientInterval}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientInterval} + + ${return} ${ClientUserTimeout} Run Keyword And Ignore Error Get From Dictionary ${TCPClientDict} ClientUserTimeout + ${ClientUserTimeout} Run Keyword If "${return}"=="FAIL" or "${ClientUserTimeout}"=="${EMPTY}" set variable null + ... ELSE set variable ${ClientUserTimeout} + + + sleep ${sleep} + click element id=tab-first #点击Client-side Parameters + sleep ${sleep} + ${class}= Get Element Attribute xpath=${Clientelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div class + #判断是否开启Override MSS按钮,${Override-MSS}=open,为开启,否则不添开启 + run keyword if "${class}"=="el-switch" and "${ClientOverrideMSS}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮开启 + ... AND sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div[2]/div/div/input ${ClientMSSvalue} #输入MSS内容 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class}"=="el-switch is-checked" and "${ClientOverrideMSS}"=="open" run keywords sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div[2]/div/div/input ${ClientMSSvalue} #输入MSS内容 + ... AND sleep ${sleep} + ... ELSE log 不操作 + run keyword if "${class}"=="el-switch is-checked" and "${ClientOverrideMSS}"!="open" run keywords sleep ${sleep} + ... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮关闭 + ... AND sleep ${sleep} + ... ELSE log 不操作 + #判断是否开启No Delay按钮,${No-Delay}=open,为开启,否则不添开启 + ${class1}= Get Element Attribute xpath=${Clientelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div class + run keyword if "${class1}"=="el-switch" and "${ClientNoDelay}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮开启 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class1}"=="el-switch is-checked" and "${ClientNoDelay}"!="open" run keywords sleep ${sleep} + ... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮关闭 + ... AND sleep ${sleep} + ... ELSE log 不操作 + input text xpath=${Clientelement}/div/form/div/label[contains(text(), "TTL")]/following-sibling::div/div/input ${Clientttlvalue} #输入ttl内容 + sleep ${sleep} + #判断是否开启Keepalive按钮,${Keepalive}=open,为开启,否则不添开启 + ${class2}= Get Element Attribute xpath=${Clientelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div class + run keyword if "${class2}"=="el-switch" and "${ClientKeepalive}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮开启 + ... AND sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ClientProbeNumber} #输入Probe Number内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ClientIdleTime} #输入Idle Time内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ClientInterval} #输入Interval内容 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class2}"=="el-switch is-checked" and "${ClientKeepalive}"=="open" run keywords sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ClientProbeNumber} #输入Probe Number内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ClientIdleTime} #输入Idle Time内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Clientelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ClientInterval} #输入Interval内容 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class2}"=="el-switch is-checked" and "${ClientKeepalive}"!="open" run keywords sleep ${sleep} + ... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮关闭 + ... AND sleep ${sleep} + ... ELSE log 不开启 + input text xpath=${Clientelement}/div/form/div/label[contains(text(), "User Timeout")]/following-sibling::div/div/input ${ClientUserTimeout} #输入User Timeout内容 + sleep ${sleep} +TCP-Server-side-Parameters + [Arguments] ${TCPServerDict} + + ${Serverelement} set variable /html/body/div[1]/div/div[3]/div[2]/div/div/div[1]/div[1]/div/div[2]/form/div[9]/div[2]/div[2] + + ${return} ${ServerOverrideMSS} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerOverrideMSS + ${ServerOverrideMSS} Run Keyword If "${return}"=="FAIL" or "${ServerOverrideMSS}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerOverrideMSS} + + ${return} ${ServerMSSvalue} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerMSSvalue + ${ServerMSSvalue} Run Keyword If "${return}"=="FAIL" or "${ServerMSSvalue}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerMSSvalue} + + ${return} ${ServerNoDelay} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerNoDelay + ${ServerNoDelay} Run Keyword If "${return}"=="FAIL" or "${ServerNoDelay}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerNoDelay} + + ${return} ${Serverttlvalue} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} Serverttlvalue + ${Serverttlvalue} Run Keyword If "${return}"=="FAIL" or "${Serverttlvalue}"=="${EMPTY}" set variable null + ... ELSE set variable ${Serverttlvalue} + + ${return} ${ServerKeepalive} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerKeepalive + ${ServerKeepalive} Run Keyword If "${return}"=="FAIL" or "${ServerKeepalive}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerKeepalive} + + ${return} ${ServerProbeNumber} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerProbeNumber + ${ServerProbeNumber} Run Keyword If "${return}"=="FAIL" or "${ServerProbeNumber}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerProbeNumber} + + ${return} ${ServerIdleTime} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerIdleTime + ${ServerIdleTime} Run Keyword If "${return}"=="FAIL" or "${ServerIdleTime}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerIdleTime} + + ${return} ${ServerInterval} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerInterval + ${ServerInterval} Run Keyword If "${return}"=="FAIL" or "${ServerInterval}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerInterval} + + ${return} ${ServerUserTimeout} Run Keyword And Ignore Error Get From Dictionary ${TCPServerDict} ServerUserTimeout + ${ServerUserTimeout} Run Keyword If "${return}"=="FAIL" or "${ServerUserTimeout}"=="${EMPTY}" set variable null + ... ELSE set variable ${ServerUserTimeout} + + click element id=tab-second #点击Server-side Parameters + sleep ${sleep} + #判断是否开启Override MSS按钮,${Override-MSS}=open,为开启,否则不添开启 + ${class}= Get Element Attribute xpath=${Serverelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div class + #判断是否开启Override MSS按钮,${Override-MSS}=open,为开启,否则不添开启 + run keyword if "${class}"=="el-switch" and "${ServerOverrideMSS}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮开启 + ... AND sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div[2]/div/div/input ${ServerMSSvalue} #输入MSS内容 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class}"=="el-switch is-checked" and "${ServerOverrideMSS}"=="open" run keywords sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div[2]/div/div/input ${ServerMSSvalue} #输入MSS内容 + ... AND sleep ${sleep} + ... ELSE log 不操作 + run keyword if "${class}"=="el-switch is-checked" and "${ServerOverrideMSS}"!="open" run keywords sleep ${sleep} + ... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮关闭 + ... AND sleep ${sleep} + ... ELSE log 不操作 + #判断是否开启No Delay按钮,${No-Delay}=open,为开启,否则不添开启 + ${class1}= Get Element Attribute xpath=${Serverelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div class + run keyword if "${class1}"=="el-switch" and "${ServerNoDelay}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮开启 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class1}"=="el-switch is-checked" and "${ServerNoDelay}"!="open" run keywords sleep ${sleep} + ... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮关闭 + ... AND sleep ${sleep} + ... ELSE log 不操作 + input text xpath=${Serverelement}/div/form/div/label[contains(text(), "TTL")]/following-sibling::div/div/input ${Serverttlvalue} #输入ttl内容 + sleep ${sleep} + #判断是否开启Keepalive按钮,${Keepalive}=open,为开启,否则不添开启 + ${class2}= Get Element Attribute xpath=${Serverelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div class + run keyword if "${class2}"=="el-switch" and "${ServerKeepalive}"=="open" run keywords sleep ${sleep} + ... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮开启 + ... AND sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ServerProbeNumber} #输入Probe Number内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ServerIdleTime} #输入Idle Time内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ServerInterval} #输入Interval内容 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class2}"=="el-switch is-checked" and "${ServerKeepalive}"=="open" run keywords sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ServerProbeNumber} #输入Probe Number内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ServerIdleTime} #输入Idle Time内容 + ... AND sleep ${sleep} + ... AND input text xpath=${Serverelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ServerInterval} #输入Interval内容 + ... AND sleep ${sleep} + ... ELSE log 不开启 + run keyword if "${class2}"=="el-switch is-checked" and "${ServerKeepalive}"!="open" run keywords sleep ${sleep} + ... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮关闭 + ... AND sleep ${sleep} + ... ELSE log 不开启 + sleep ${sleep} + input text xpath=${Serverelement}/div/form/div/label[contains(text(), "User Timeout")]/following-sibling::div/div/input ${ServerUserTimeout} #输入User Timeout内容 + sleep ${sleep} +TCP-OK + sleep ${sleep} + click element id=proxyManipulationSuccess #点击OK + sleep ${sleep} +TCP-Assertion + [Arguments] ${name} ${search}=Name + Proxy-TCP-Options-Search ${name} ${search} #搜索刚新建的name + ${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/p #获取点击后页面文本信息 + Should Be Equal As Strings ${text1} ${name} #断言 + + + +Proxy-TCP-Options-Search + [Arguments] ${value} ${search} + sleep ${sleep} + click element id=sidebarAdvanced + sleep ${sleep} + Wait Until Element Is Visible xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div[1]/div/div[1]/span/div/div/div[2]/div/div/div/input 20 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div[1]/div/div[1]/span/div/div/div[2]/div/div/div/input #点击搜索框 + sleep ${sleep} + #判断是使用name搜索还是id搜索 + run keyword if "${search}"=="Name" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] + ... AND input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div[1]/div/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${value} + ... ELSE IF "${search}"=="ID" run keywords sleep ${sleep} + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[2] + ... AND input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div[1]/div/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${value} + ... AND sleep ${sleep} + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div[1]/div/div[1]/span/div/i #点击搜索按钮 + sleep ${sleep} + Run Keyword And Ignore Error click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] #点击搜索到的列表 + sleep ${sleep} + + +Delete-Proxy-estimate + [Arguments] ${securityname} + run keyword if "${securityname}"!="null" run keywords sleep ${sleep} + ... AND Delete-Proxy ${securityname} + ... ELSE log go on + +Delete-Proxy + [Arguments] ${securityname} + + Menu settings Advanced + sleep ${sleep} + Proxy-TCP-Options-Search ${securityname} Name + sleep ${sleep} + Run Keyword And Ignore Error click element id=proxyTCPDel + sleep ${sleep} + Run Keyword And Ignore Error click element xpath=/html/body/div/div/div[3]/button[2] + sleep ${sleep} + +Delete-object-estimate + [Arguments] ${obj} + run keyword if "${obj}"!="null" run keywords sleep ${sleep} + ... 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 ${sleep} + 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 ${sleep} + click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] #点击name为搜索类型 + sleep ${sleep} + 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 ${sleep} + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i #点击搜索按钮 + sleep ${sleep} + 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 ${sleep} + sleep ${sleep} + Run Keyword And Ignore Error click element id=objectDel #点击删除按钮 + sleep ${sleep} + Run Keyword And Ignore Error click element xpath=/html/body/div/div/div[3]/button[2] + sleep ${sleep} + END \ No newline at end of file