first init project code

This commit is contained in:
dongxiaoyan
2020-04-01 12:42:05 +08:00
commit acc676857b
138 changed files with 32456 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
*** Settings ***
Library String
Library json
Library OperatingSystem
Library RequestsLibrary
Library Selenium2Library
Library Collections
Library FileLibrary
Resource ../../02-Keyword/tsg_bfapi/Common.robot
Resource ../../03-Variable/BifangApiVariable.txt
*** Keywords ***
insert_policyId_to_file
[Arguments] ${key} ${policyId} ${objectids}
${dict} Create Dictionary policyId=${policyId} objectId=${objectids}
${json} json.Dumps ${dict}
Alter Dict ${path}/03-Variable/AllFlowCaseVariable.txt ${key} ${json}
insert_time_to_file
[Arguments] ${key} ${starttime} ${endtime}
${value} json.Loads ${${key}}
${dict} Create Dictionary policyId=${value}[policyId] objectId=${value}[objectId] starttime=${starttime} endtime=${endtime}
${json} json.Dumps ${dict}
Alter Dict ${path}/03-Variable/AllFlowCaseVariable.txt ${key} ${json}

View File

@@ -0,0 +1,35 @@
*** Settings ***
Library OperatingSystem
Library Selenium2Library
Library RequestsLibrary
Library Collections
*** Keywords ***
SystemCommands
[Arguments] ${commandstr} ${stringlist}
log toSystemCommand_SystemCommandTest
${commandreturn} OperatingSystem.Run ${commandstr}
${listlenth}= Get Length ${stringlist}
FOR ${var} IN RANGE ${listlenth}
#log ${var}
Should Contain ${commandreturn} ${stringlist}[${var}]
END
${rescode} Set Variable 200
log ${rescode}
[Return] ${rescode}
SystemCommand
[Arguments] ${commandstr} @{stringlist}
log dxytest${commandstr}
${commandreturn} OperatingSystem.Run ${commandstr}
#nslookup -d www.jd.com
log ${commandreturn}
FOR ${var} IN @{stringlist}
log dxytest
log ${var}
Should Contain ${commandreturn} ${var}
END
#Should Contain ${commandreturn} ${qatype}
${rescode} Set Variable 200
log ${rescode}
[Return] ${rescode}

View File

@@ -0,0 +1,50 @@
*** Settings ***
Library Collections
Library RequestsLibrary
Resource ../../03-Variable/BifangApiVariable.txt
*** Keywords ***
Post-Request
[Arguments] ${url} ${data}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Post Request api ${url} data=${data} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
[Return] ${response}
Get-Request
[Arguments] ${url}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Get Request api ${url} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
[Return] ${response}
Delete-Request
[Arguments] ${url} ${data}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Delete Request api ${url} data=${data} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
[Return] ${response}
UpFilePostRequest
[Arguments] ${url} ${data} ${files} ${fileDesc}
${header} Set To Dictionary ${fileDesc} Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Post Request api ${url} data=${data} files=${files} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
[Return] ${response}
UpFilePutRequest
[Arguments] ${url} ${data} ${files} ${fileDesc}
${header} Set To Dictionary ${fileDesc} Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Put Request api ${url} params=${data} files=${files} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
[Return] ${response}

View File

@@ -0,0 +1,36 @@
*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Library REST http://${host}:${port}
Library Collections
Library RequestsLibrary
*** Keywords ***
BasePostRequest
[Arguments] ${apistr} ${body}
Set Headers {"Authorization":"${token}","Content-Type":"application/json"}
&{httpResponse} Post ${apistr} ${body}
Output response body
Object response body
#Integer $.code 200
#Array $.data.policyList
${response} Set Variable ${httpResponse.body}
[Return] ${response}
BaseDeleteRequest
[Arguments] ${requestUri} ${data}
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
create session api http://${host}:${port} ${headers}
${response}= Delete Request api ${requestUri} data=${data}
log return data =${response}
Should Be Equal As Strings ${response.status_code} 200
${response} to json ${response.content}
[Return] ${response}
BaseEditRequest
[Arguments] ${requestUri} ${data}
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
create session api http://${host}:${port} ${headers}
${response}= Put Request api ${requestUri} data=${data}
log return data =${response}
Should Be Equal As Strings ${response.status_code} 200
${response} to json ${response.content}
[Return] ${response}

View File

@@ -0,0 +1,33 @@
*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Library RequestsLibrary
Library OperatingSystem
Library Collections
Library string
Library REST http://${host}:${port}
*** Keywords ***
GetLogCondition
[Arguments] ${logname} ${startTime} ${endTime} ${client_ip} ${policy_id}
Set Headers {"Content-Type":"application/x-www-form-urlencoded","Authorization":"${token}"}
&{LogSchemaResponse}= GET /v1/log/schema?logType=${logname}
log ${logname}
Output Schema response body
Object response body
#Integer $.code 200
log ${LogSchemaResponse.body['data']}
${field} Evaluate json.dumps(eval(str(${LogSchemaResponse.body['data']['fields']}))) json
log ${field}
${pageSize} Set Variable 30
${pageNo} Set Variable 1
${condition} Set Variable [{"value":["${startTime}","${endTime}"],"symbol":"between","field":"common_recv_time","type":"timestamp"}]
${logCondition} Set Variable {"pageNo":${pageNo},"pageSize":${pageSize},"logType":"${logname}","fields":${field},"start_common_recv_time":"${startTime}","end_common_recv_time":"${endTime}","conditions":${condition} ,"common_client_ips":"${client_ip}","common_policy_ids":"${policy_id}"}
log this time query condition:${logCondition}
[Return] ${logCondition}
PostRemoteData
[Arguments] ${url} ${data}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Post Request api ${url} data=${data} headers=${header}
[Return] ${remoteResponse}

View File

@@ -0,0 +1,32 @@
*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Resource LogSchema.robot
Library REST http://${host}:${port}/${version}
Library RequestsLibrary
Library OperatingSystem
Library Collections
Library string
*** Keywords ***
GetLogList
[Arguments] ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id} ${parmkey} ${parmvalue}
${logCondition} GetLogCondition ${logType} ${startTime} ${endTime} ${client_ip} ${policy_id}
log ${logCondition}
${LogListResponse} PostRemoteData /log/list ${logCondition}
Should Be Equal As Strings ${LogListResponse.status_code} 200
${returnData} To Json ${LogListResponse.content}
${responseCode} Get From Dictionary ${returnData} code
Log ${responseCode}
Should Be Equal ${responseCode} ${200} security_event_log \ \ test query list failed
log this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
${a} Set Variable this time request security_event_log \ table logRecord \ : ${LogListResponse.content}
log ${a}
${log} Set Variable ${LogListResponse.json()}[data][list]
FOR ${logs} IN ${log}
log ${logs}
END
log %%%%%%%%%%%%%%%%%%%%%%%%${logs}
Should Contain ${logs}"" ${client_ip}
Should Contain ${logs}"" ${policy_id}
Should Contain ${logs}"" ${parmkey}
Should Contain ${logs}"${parmkey}" ${parmvalue}

View File

@@ -0,0 +1,84 @@
*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Library REST http://${host}:${port}
Library Collections
Library SSHLibrary
Resource PolicyObject.robot
Resource ../tsg_ui/Logout/Logout.robot
Resource ../tsg_ui/Login/Login.robot
Resource Tag.robot
*** Keywords ***
Login
#[Arguments] ${username} ${password} ${authmode} ${authCode} ${ldapId}
# 毕方接口用户名密码
GET /v1/user/encryptpwd?password=${password}
Object response body
#OUTPUT response body
#${rescode} Integer $.code
Integer $.code 200
#log ${rescode}
${pwd} String $.data.encryptpwd
#log ${pwd}
${pwdstr} Get From List ${pwd} 0
#log aaaaaaa
log ${pwdstr}
#log bbb
SET GLOBAL VARIABLE ${encodePassword} ${pwdstr}
#log aaaaaaa
log ${encodePassword}
#log aaaaaaa
#log ${host}:${port}
#getToken##################################################################################
#log ${username}
#log ${pwdstr}
POST /v1/user/login?username=${username}&password=${encodePassword}&authMode=${authmode}
Object response body
#OUTPUT response body
Integer $.code 200
#${rescodelist} Integer $.code
#${rescode} Get From List ${rescodelist} 0
${rescode} Integer $.code
log ${rescode}
${tokenGlobal} String $.data.token
${tokenStr} Get From List ${tokenGlobal} 0
log ${tokenStr}
SET GLOBAL VARIABLE ${token} ${tokenStr}
log ${token}
SET GLOBAL VARIABLE ${headers} {"Contest-Type":"application/json","Authorization":"${token}"}
#Return ${rescode}
Logout
POST /v1/user/logout headers=${headers}
Object response body
Integer $.code 200
${rescode} Integer $.code
#[Return] ${rescode}
ApiLoginAndAddLocalIP
[Arguments] ${tempparm}
log ApiLoginAndAddLocalIP${tempparm}
loginlogout.Login
#log **********
Run Keyword If ${addTestClentIPFlag}==1 AddLocalIPObject
log ApiLoginAndAddLocalIP
#ApiAddAutoTagsCase
#[Return] ${rescode}
ApiLogoutAndDelLocalIP
[Arguments] ${tempparm}
log ApiLogoutAndDelLocalIP${tempparm}
log to_LogoutAndDelLocalIP_LogoutAndDelLocalIP
Run Keyword If ${addTestClentIPFlag}==1 DelLocalIPObject
#ApiDeleteAutoTagsCase
loginlogout.Logout
#[Return] ${rescode}
CliLogin
Open Connection ${cliHost}
SSHLibrary.Login ${cliUsername} ${cliPassword}
CliLogout
Close Connection
Log Close connection
#exit

View File

@@ -0,0 +1,111 @@
*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Library REST http://${host}:${port}
Library Collections
Library RequestsLibrary
Resource Common.robot
*** Keywords ***
AddLocalIPObject
#创建对象IP
log to_AddLocalIPObject
${localIP} set variable {"opAction":"add","returnData":1,"objectList":{"objectType":"ip","objectSubType":"endpoint","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"autotestLocalIPObject_${testClentIP}","objectDesc":"LocalIPObject_${testClentIP}自动化测试机IP","subObjectIds":[],"addItemList":[{"addrType":4,"protocol":0,"direction":0,"isSession":"endpoint","clientIp1":"${testClentIP}","clientIp2":"${testClentIP}","clientIpFormat":"range","clientPortFormat":"range","clientPort1":0,"clientPort2":0,"serverIpFormat":"range","serverIp1":"","serverIp2":"","serverPortFormat":"range","serverPort1":0,"serverPort2":0}],"updateItemList":[],"deleteItemIds":[]}}
${rescodeip} ${objidip} AddObject ${localIP}
log ${rescodeip}
log LocalIP${objidip}
SET GLOBAL VARIABLE ${testClentID} ${objidip}
DelLocalIPObject
log to_DelLocalIPObject
${response} BaseDeleteRequest /v1/policy/object {"objectIds":[${testClentID}]}
#${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
SET GLOBAL VARIABLE ${testClentID} ${EMPTY}
AddObject
[Arguments] ${body}
#addIPobject#################################################################################
${response} BasePostRequest /v1/policy/object body=${body}
#log ${response}
${objectId} Set Variable ${response['data']['objectList'][0]['objectId']}
${rescodeReturn} Set Variable ${response['code']}
[Return] ${rescodeReturn} ${objectId}
EditObject
[Arguments] @{body}
[Return] ${rescode} ${objectId}
DeleteObjectbak
[Arguments] ${objectids}
${body} String {"objectIds":[${objectids}]}
DELETE /v1/policy/object body=${body} headers=${headers}
Object response body
log DeleteObject
log dxytestOUtputstart
Output response body
log dxytestOUtputstart
${rescode} Integer $.code
${rescodeReturn} Get From List ${rescode} 0
[Return] ${rescodeReturn}
AddPolicy
[Arguments] ${body}
${response} BasePostRequest /v1/policy/compile body=${body}
#log ${response}
${policyId} Set Variable ${response['data']['policyList'][0]['policyId']}
${rescode} Set Variable ${response['code']}
[Return] ${rescode} ${policyId}
EditPolicy
[Arguments] @{body}
[Return] ${rescode} ${objectId}
DeletePolicybak
[Arguments] ${policyids}
${body} String {"policyType":"tsg_security","policyIds":[${policyids}]}
DELETE /v1/policy/compile body=${body} headers=${headers}
Object response body
log DeletePolicy
Output response body
${rescode} Integer $.code
${rescodeReturn} Get From List ${rescode} 0
[Return] ${rescodeReturn}
DeletePolicy
[Arguments] ${body}
#删除策略
log toDeletePolicy_DeletePolicyDeletePolicy
${response} BaseDeleteRequest /v1/policy/compile ${body}
#{"policyType":"tsg_security","policyIds":[${policyids}]}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
DeleteObject
[Arguments] ${objectids}
#删除对象
log todeleteobj
${response} BaseDeleteRequest /v1/policy/object {"objectIds":[${objectids}]}
${response_code} Get From Dictionary ${response} code
#log aaaaaaaaaa:${response_code}
Should Be Equal As Strings ${response_code} 200
#Integer ${response_code} 200
${response} Convert to String ${response}
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
DeletePolicyAndObject
[Arguments] ${policyids} ${objectids}
#删除和对象
#删除策略
log toDeletePolicy_DeletePolicyAndObject
${listlenth}= Get Length ${policyids}
FOR ${var} IN RANGE ${listlenth}
#log dxytest111111
log ${var}
DeletePolicy ${policyids}[${var}]
#Should Contain ${commandreturn} ${ca}
END
#删除对象
log todeleteobj_DeletePolicyAndObject
DeleteObject ${objectids}

View File

@@ -0,0 +1,41 @@
*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Library REST http://${host}:${port}
Library Collections
Library RequestsLibrary
Resource Common.robot
*** Keywords ***
ApiAddTags
[Arguments] ${body}
#ApiAddTags#################################################################################
${response} BasePostRequest /v1/customize/tags body=${body}
#log ${response}
${tagId} Set Variable ${response['data']['tagList'][0]['id']}
${rescodeReturn} Set Variable ${response['code']}
[Return] ${rescodeReturn} ${objectId}
ApiEditTags
[Arguments] @{body}
[Return] ${rescode} ${objectId}
ApiDeleteTags
[Arguments] ${body}
#删除策略
log toApiDeleteTags
${response} BaseDeleteRequest /v1/customize/tags ${body}
${response_code} Get From Dictionary ${response} code
Should Be Equal As Strings ${response_code} 200
${response} Convert to String ${response}
Should Be Equal As Strings ${response} {'code': 200, 'msg': 'Success', 'success': True}
ApiAddAutoTagsCase
#ApiAddTags#################################################################################
${rescode} ${tag_id} ApiAddTags {"tagList":{"id":0,"isValid":1,"opTime":1585652133641,"opUser":0,"optionType":2,"pid":0,"tagId":"","tagColor":"rgb(21, 101, 192)","tags":[{"tagId":"","tagName":"ApiAutoTest","key":1585652121540}],"tagList":[],"tagCategory":"AutoTest"},"returnData":0}
log ${tag_id}
SET GLOBAL VARIABLE ${userTagIds} ${tag_id}
ApiDeleteAutoTagsCase
#ApiAddTags#################################################################################
ApiDeleteTags {"ids":[${userTagIds}]}

View File

@@ -0,0 +1,192 @@
*** Settings ***
Library String
Library OperatingSystem
Library RequestsLibrary
Library Selenium2Library
Library Collections
Resource ../../../02-Keyword/tsg-bf-api/common.txt
Resource ../../../02-Keyword/tsg-bf-api/apirequest.txt
Resource ../../../03-Variable/bifangapivariable.txt
*** Keywords ***
QueryPolicyFile
[Arguments] ${url} ${suffix}
${content_quary} Get-Request ${url}?isValid=1&${suffix}
${msg_quary} Set Variable ${content_quary['msg']}
${length} Get Length ${content_quary['data']['list']}
Should Be True ${length}>0
Log quary operation:${msg_quary}
Log data:${content_quary['data']['list']}
QueryPolicyFile2
[Arguments] ${url} ${suffix}
${content_quary} Get-Request ${url}?${suffix}
${msg_quary} Set Variable ${content_quary['msg']}
${length} Get Length ${content_quary['data']['list']}
Should Be True ${length}>0
Log quary operation:${msg_quary}
Log data:${content_quary['data']['list']}
${certId} Set Variable ${content_quary['data']['list'][0]['certId']}
[Return] ${certId}
CreatePolicyFile
[Documentation]
... 必传参数url、filePath文件路径、fileName文件名称
... 可选参数header不传时使用默认值
[Arguments] ${url} ${filePath} ${fileName} @{header}
${suffix} Generate Random String
${certName} Catenate SEPARATOR=_ test ${suffix}
${header} Run Keyword If ${header}==[] Set Variable {"isValid":1,"opAction":"add","certName":"${certName}","certId":null,"returnData":1}
... ELSE Get From List ${header} 0
${binFile} Evaluate open(r"${path}/${filePath}${fileName}",'rb')
${fileDict} Create Dictionary file=${binFile}
${requestData} Create Dictionary name="file" filename="${fileName}" Content-Type=application/octet-stream
${fileDesc} Create Dictionary File-Desc=${header}
${content} UpFilePostRequest ${url} ${requestData} ${fileDict} ${fileDesc}
${msg} Set Variable ${content['msg']}
${list} Set Variable ${content['data']['list']}
${cerId} Set Variable ${list[0]['certId']}
${certName} Set Variable ${list[0]['certName']}
${response} Create Dictionary msg=${msg} certId=${cerId} certName=${certName}
Log add operation:${msg}
Log cerId:${cerId}
[Return] ${response}
CreatePolicyFile2
[Documentation]
... 必传参数url、filePath文件路径、fileName文件名称、flag(模块标识)
... 可选参数header不传时使用默认值
[Arguments] ${url} ${filePath} ${fileName} ${flag} @{header}
${suffix} Generate Random String
${randomName} Catenate SEPARATOR=_ test ${suffix}
${value} Run Keyword If '${flag}'=='resPages' Set Variable {"isValid":1,"format":"html","opAction":"add","profileName":"${randomName}","profileId":null,"returnData":1}
... ELSE IF '${flag}'=='hijack' Set Variable {"isValid":1,"contentType":"text/html","opAction":"add","profileName":"${randomName}","contentName":"${fileName}","profileId":null,"returnData":1}
... ELSE IF '${flag}'=='insert' Set Variable {"isValid":1,"format":"js","insertOn":"after_page_load","opAction":"add","profileName":"${randomName}","profileId":null,"returnData":1}
${header} Run Keyword If ${header}==[] Set Variable ${value}
... ELSE Get From List ${header} 0
${binFile} Evaluate open(r"${path}/${filePath}${fileName}",'rb')
${fileDict} Create Dictionary file=${binFile}
${requestData} Create Dictionary name="file" filename="${fileName}" Content-Type=application/octet-stream
${suffix} Generate Random String
${profileName} Catenate SEPARATOR=_ test ${suffix}
${fileDesc} Create Dictionary File-Desc=${header}
${content} UpFilePostRequest ${url} ${requestData} ${fileDict} ${fileDesc}
${msg} Set Variable ${content['msg']}
${list} Set Variable ${content['data']['list']}
${profileId} Set Variable ${list[0]['profileId']}
${profileName} Set Variable ${list[0]['profileName']}
${response} Create Dictionary msg=${msg} profileId=${profileId} profileName=${profileName}
Log add operation:${msg}
Log profileId:${profileId}
[Return] ${response}
CreatePolicyFile3
[Documentation]
... 必传参数url
... 可选参数data不传时使用默认值
[Arguments] ${url} @{data}
${suffix} Generate Random String
${profileName} Catenate SEPARATOR=_ test ${suffix}
${data} Run Keyword If ${data}==[] Set Variable {"opAction":"add","returnData":1,"trafficMirrorList":[{"profileName":"${profileName}","addrType":"mac","isValid":1,"addrArray":["00:A1:B2:06:C3:29"]}]}
... ELSE Get From List ${data} 0
${content} Post-Request ${url} ${data}
${msg} Set Variable ${content['msg']}
${list} Set Variable ${content['data']['list']}
${profileId} Set Variable ${list[0]['profileId']}
${profileName} Set Variable ${list[0]['profileName']}
${response} Create Dictionary msg=${msg} profileId=${profileId} profileName=${profileName}
Log add operation:${msg}
Log profileId:${profileId}
[Return] ${response}
CreatePolicyMutipartFile
[Documentation]
... 必传参数url、filePath文件路径、pubFileName证书文件名、priFileName私钥文件名
... 可选参数header不传时使用默认值
[Arguments] ${url} ${filePath} ${pubFileName} ${priFileName} @{header}
${suffix} Generate Random String
${certName} Catenate SEPARATOR=_ test ${suffix}
${header} Run Keyword If ${header}==[] Set Variable {"isValid":1,"opAction":"add","returnData":1,"keyringName":"${certName}","keyringType":"root","reissueExpiryHour":0,"crl":"null","publicKeyAlgo":"rsa1024","keyringId":null,"includeRoot":0}
... ELSE Get From List ${header} 0
${pubFile} Evaluate open(r"${path}/${filePath}${pubFileName}",'rb')
${priFile} Evaluate open(r"${path}/${filePath}${priFileName}",'rb')
${fileDict} Create Dictionary publicFile ${pubFile}
Set To Dictionary ${fileDict} privateFile ${priFile}
${requestData} Create Dictionary name="publicFile" filename="${pubFileName}" Content-Type=application/octet-stream
Set To Dictionary ${requestData} name privateFile
Set To Dictionary ${requestData} filename ${priFileName}
Set To Dictionary ${requestData} Content-Type application/octet-stream
${fileDesc} Create Dictionary File-Desc=${header}
${content} UpFilePostRequest ${url} ${requestData} ${fileDict} ${fileDesc}
${msg} Set Variable ${content['msg']}
${list} Set Variable ${content['data']['list']}
${keyringId} Set Variable ${list[0]['keyringId']}
${keyringName} Set Variable ${list[0]['keyringName']}
${response} Create Dictionary msg=${msg} keyringId=${keyringId} keyringName=${keyringName}
Log add operation:${msg}
Log keyringId:${keyringId}
[Return] ${response}
UpdatePolicyMutipartFile
[Arguments] ${url} ${filePath} ${pubFileName} ${priFileName} ${reqHeader}
${pubFile} Evaluate open(r"${path}/${filePath}${pubFileName}",'rb')
${priFile} Evaluate open(r"${path}/${filePath}${priFileName}",'rb')
${fileDict} Create Dictionary publicFile ${pubFile}
Set To Dictionary ${fileDict} privateFile ${priFile}
${requestData} Create Dictionary name="publicFile" filename="${pubFileName}" Content-Type=application/octet-stream
Set To Dictionary ${requestData} name privateFile
Set To Dictionary ${requestData} filename ${priFileName}
Set To Dictionary ${requestData} Content-Type application/octet-stream
${fileDesc} Create Dictionary File-Desc ${reqHeader}
${content} UpFilePutRequest ${url} ${requestData} ${fileDict} ${fileDesc}
${msg} Set Variable ${content['msg']}
Log update operation:${msg}
Log update condition:${reqHeader}
UpdatePolicyFile
[Arguments] ${url} ${filePath} ${fileName} ${reqHeader}
${binFile} Evaluate open(r"${path}/${filePath}${fileName}",'rb')
${fileDict} Create Dictionary file=${binFile}
${requestData} Create Dictionary name="file" filename="${fileName}" Content-Type=application/octet-stream
${fileDesc} Create Dictionary File-Desc=${reqHeader}
${content} UpFilePutRequest ${url} ${requestData} ${fileDict} ${fileDesc}
${msg} Set Variable ${content['msg']}
Log update operation:${msg}
Log update condition:${reqHeader}
UpdatePolicyFile2
[Arguments] ${url} ${data}
${header} Create Dictionary Content-Type=application/json Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Put Request api ${url} data=${data} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
${msg} Set Variable ${response['msg']}
Log update operation:${msg}
Log update condition:${data}
DeletePolicyFile
[Arguments] ${url} ${data}
${content} Delete-Request ${url} ${data}
${msg} Set Variable ${content['msg']}
Log delete operation:${msg}
Log delete condition:${data}
TeardownDelete
[Arguments] ${url} ${key} ${value}
${ids} Create List ${value}
${data} Create Dictionary ${key}=${ids}
${content} Delete-Request ${url} ${data}
${msg} Set Variable ${content['msg']}
Log teardown operation:${msg}
Log teardown condition:${data}

View File

@@ -0,0 +1,281 @@
*** Settings ***
Library json
Library String
Library DateTime
Library SSHLibrary
Library Collections
Library RequestsLibrary
Library Selenium2Library
Resource ../../03-Variable/bifangapivariable.txt
*** Variables ***
${Tsg_Policy} tsg_policy
${Tsg_Policy_Object} tsg_policy_object
${Tsg_Record} tsg_record
${Tsg_Show} tsg_show
${Tsg_Passwd} tsg_passwd
${Tsg_Help_file_Path} cli_files/tsg_help.txt
*** Keywords ***
Get_Policy_Object1
[Arguments] ${type}
${dict} Tsg_Policy_Query ${type} ${None} ${None} ${None} ${True}
Should Be True ${dict}[data][total] > 1
[Return] ${dict}[data][list][1]
Get_Policy_Object2
[Arguments] ${type}
${dict} Tsg_Policy_Query ${type} ${None} ${None} ${None} ${True}
[Return] ${dict}[data][list][0]
Get_Policy_Object3
[Arguments] ${type}
${obj} Get_Policy_Object1 ${type}
${commandType1} Run Keyword If ${obj}[isValid]==0 Set Variable enable
... ELSE Set Variable disable
${commandType2} Run Keyword If ${obj}[isValid]==1 Set Variable enable
... ELSE Set Variable disable
Set To Dictionary ${obj} commandType1=${commandType1} commandType2=${commandType2}
[Return] ${obj}
Get_Policy_Object4
[Arguments] ${type}
${dict} Tsg_Policy_Object_Query ${type} ${None} ${True}
[Return] ${dict}[data][list][0]
Get_File_Name
[Arguments] ${ObjectType} ${FileType}
${date} Get Current Date
${date_stamp} Convert Date ${date} epoch
${time} Evaluate int(round(${date_stamp} * 1000))
${filename} Set Variable ${ObjectType}_export_${time}.${FileType}
[Return] ${filename}
Get_Import_Info
[Arguments] ${type}
${date} Get Current Date
${date_stamp} Convert Date ${date} epoch
${time} Evaluate int(round(${date_stamp} * 1000))
${name} Set Variable ${type}_import_${time}
[Return] ${name}
Tsg_Policy_Query
# ${type}:必传 @{param}:非必传,最大参数数量为四位。依次顺序为'policyId'、'policyName'、'policyDesc'和'allFlag',中间存在为空参数可用'${None}'占位
[Arguments] ${type} @{params}
${str} Evaluate '${Tsg_Policy} --query --policyType %s ' % ('${type}')
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str}--policyId %s ' % ('${params}[0]')
... ELSE Set Variable ${str}
${str} Run Keyword If '${params}[1]' != '${None}' Evaluate '${str}--policyName "%s" ' % ('${params}[1]')
... ELSE Set Variable ${str}
${str} Run Keyword If '${params}[2]' != '${None}' Evaluate '${str}--policyDesc "%s" ' % ('${params}[2]')
... ELSE Set Variable ${str}
${str} Run Keyword If ${params}[3] == ${True} Evaluate '${str}--all '
... ELSE Set Variable ${str}
Log ${str}
${r} Run1 ${str}
[Return] ${r}
Tsg_Policy_EnDisable
# ${id}:必传 ${type}:必传 ${commandType}:必传'enable'|'disable'
[Arguments] ${id} ${type} ${commandType}
${str} Evaluate '${Tsg_Policy} --%s --policyId %s --policyType %s' % ('${commandType}', '${id}', '${type}')
Run2 ${str}
Tsg_Policy_Object_Query
# @{param}:非必传,最大参数数量为三位。依次顺序为'objectName'、'objectType'和'allFlag',中间存在为空参数可用'${None}'占位
[Arguments] @{params}
${str} Set Variable ${Tsg_Policy_Object} --query
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str} --objectType "%s" ' % ('${params}[0]')
... ELSE Set Variable ${str}
${str} Run Keyword If '${params}[1]' != '${None}' Evaluate '${str} --objectName "%s" ' % ('${params}[1]')
... ELSE Set Variable ${str}
${str} Run Keyword If ${params}[2] == ${True} Evaluate '${str} --all '
... ELSE Set Variable ${str}
${r} Run1 ${str}
[Return] ${r}
Tsg_Policy_Object_Import
# ${type}:必传 ${file}:必传 @{params}:非必传,含义'objectName'
[Arguments] ${type} ${file} @{params}
${newFile} Replace String ${file} export import
${command} Set Variable head -n 2 files/${file} > files/${newFile}
Run4 ${command}
${str} Evaluate '${Tsg_Policy_Object} --import --objectType %s --file files/%s ' % ('${type}','${newFile}')
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str}--objectName %s ' % ('${params}[0]')
... ELSE Set Variable ${str}
Run3 ${str}
Tsg_Policy_Object_Export
# ${type}:必传 ${file}:必传 @{params}:非必传,含义'exportFormat'(txt|csv)
[Arguments] ${type} ${file} @{params}
${str} Evaluate '${Tsg_Policy_Object} --export --objectType %s --file files/%s ' % ('${type}','${file}')
${str} Run Keyword If '${params}[0]' != '${None}' Evaluate '${str}--exportFormat %s ' % ('${params}[0]')
... ELSE Set Variable ${str}
Run3 ${str}
Tsg_Record_UserList
${str} Set Variable ${Tsg_Record} --userlist
Run6 ${str} ${cliUsername}
Tsg_Record_Query
${str} Evaluate '${Tsg_Record} --username %s ' % ('${cliUsername}')
${param} Set Variable ${Tsg_Record} --userlist
Run6 ${str} ${param}
Clear_Test_Data
${str} Set Variable rm -rf /home/${cliUsername}/files/*
Run4 ${str}
Tsg_Help_Keyword
${r} Run5 tsg_help
${data} Evaluate open(r"${path}/${Tsg_Help_file_Path}",'rb').read()
Should Be Equal As Strings ${r} ${data}
Tsg_Diagnose_Keyword
Write Until Expected Output tsg_diagnose\n Success ${timeout} ${timeout}
Tsg_Show_Chassis-ip
${str} Set Variable ${Tsg_Show} --chassis-ip
${r} Run5 ${str}
Should Contain ${r} Name
Should Contain ${r} IP
Tsg_Show_Chassis-port
${str} Set Variable ${Tsg_Show} --chassis-port
${r} Run5 ${str}
Should Contain ${r} PortId
Should Contain ${r} Type
Should Contain ${r} Function
Should Contain ${r} Description
Tsg_Show_Interface
${str} Set Variable ${Tsg_Show} --interface
${r} Run5 ${str}
Should Contain ${r} time
Should Contain ${r} PhyRXBits
Should Contain ${r} PhyRXFrame
Should Contain ${r} PhyTXBits
Should Contain ${r} PhyTXFrame
Should Contain ${r} flow_type
Should Contain ${r} sled
Tsg_Show_APP
${str} Set Variable ${Tsg_Show} --app
${r} Run5 ${str}
Should Contain ${r} time
Should Contain ${r} RxBits
Should Contain ${r} RxPkts
Should Contain ${r} TxBits
Should Contain ${r} TxPkts
Should Contain ${r} device
Should Contain ${r} flow_type
Should Contain ${r} sled
Tsg_Show_Protocol
${str} Set Variable ${Tsg_Show} --protocol
${r} Run5 ${str}
Should Contain ${r} time
Should Contain ${r} Eth_Bit
Should Contain ${r} Ipv4_Bit
Should Contain ${r} Ipv6_Bit
Should Contain ${r} Tcp_Bit
Should Contain ${r} Udp_Bit
Should Contain ${r} device
Should Contain ${r} flow_type
Should Contain ${r} sled
Tsg_Show_Stream
${str} Set Variable ${Tsg_Show} --stream
${r} Run5 ${str}
Should Contain ${r} time
Should Contain ${r} Tcp_Link_New
Should Contain ${r} Tcp_Concurrent
Should Contain ${r} Tcp_Link_Double
Should Contain ${r} device
Should Contain ${r} flow_type
Should Contain ${r} sled
Tsg_Show_Intercept
${str} Set Variable ${Tsg_Show} --intercept
${r} Run5 ${str}
Should Contain ${r} time
Should Contain ${r} intcp_rdy_bits
Should Contain ${r} intcp_rdy_stm
Should Contain ${r} intcped_bits
Should Contain ${r} intcped_stm
Should Contain ${r} sled
Tsg_Passwd_Keyword
${str1} Evaluate '${Tsg_Passwd} --password %s' % ('${cliPassword}x')
Run7 ${str1}
${str2} Evaluate '${Tsg_Passwd} --password %s --username %s' % ('${cliPassword}y','${cliUsername}')
Run7 ${str2}
${str3} Evaluate '${Tsg_Passwd} --password %s' % ('${cliPassword}')
Run7 ${str3}
Run1
[Arguments] ${command}
Write ${command}
${r} Read delay=10s
${dict} Run Keyword If '${cliUsername}'!='tsgadmin' Run1_A ${r}
... ELSE Run1_B ${r}
[Return] ${dict}
Run1_A
[Arguments] ${r}
Should Contain ${r} Permission denied
${dict} To Json {"data":{"list":[{"policyDesc":"","policyId":0,"policyName":"","policyType":"","objectType":"","objectName":"","isValid":0},{"policyDesc":"","policyId":0,"policyName":"","policyType":"","isValid":0}],"total":2},"msg":"Success"}
[Return] ${dict}
Run1_B
[Arguments] ${r}
Should Contain ${r} Success
${str} Replace String ${r} ${\n} -
${str} Replace String ${str} ' \\'
${index} Evaluate '${str}'.rindex('}') + 1
${len} Convert To Integer ${index}
${json} Evaluate '${str}'[0:${len}]
${dict} json.Loads ${json}
Should Be True ${dict}[data][total] > 0
[Return] ${dict}
Run2
[Arguments] ${command}
Write ${command}
${r} Read delay=10s
Run Keyword If '${cliUsername}'!='tsgadmin' Should Contain ${r} Permission denied
... ELSE Should Contain ${r} Success
Run3
[Arguments] ${command}
${flag} Run Keyword If '${cliUsername}'!='tsgadmin' Set Variable Permission denied
... ELSE Set Variable Success
Write Until Expected Output ${command}\n ${flag} ${timeout} ${timeout}
Run4
[Arguments] ${command}
Write ${command}
${r} Read delay=10s
Run Keyword If '${cliUsername}'!='tsgadmin' Should Contain Any ${r} Permission denied -bash:
... ELSE Should Not Contain ${r} head:
Run5
[Arguments] ${command}
Write ${command}
${r} Read delay=10s
Should Not Be Empty ${r}
[Return] ${r}
Run6
[Arguments] ${command} ${param}
Write ${command}
${r} Read delay=10s
Should Not Be Empty ${r}
Run Keyword If '${cliUsername}'!='tsgadmin' Should Contain ${r} Permission denied
... ELSE Should Contain ${r} ${param}
Run7
[Arguments] ${command}
Write ${command}
${r} Read delay=10s
Should Contain ${r} Success

View File

@@ -0,0 +1,18 @@
*** Settings ***
Resource ../../03-Variable/BifangApiVariable.txt
Library REST http://${host}:${port}
Library Collections
Resource ../tsg_bfapi/LoginLogout.robot
Resource ../tsg_ui/Logout/Logout.robot
Resource ../tsg_ui/Login/Login.robot
*** Keywords ***
LoginAndAddLocalIP
Run Keyword If '${loginType}' == 'api' ApiLoginAndAddLocalIP aa
... ELSE IF '${loginType}' == 'cli' CliLogin
... ELSE UiLoginAndAaddLocalIP bb
LogoutAndDelLocalIP
Run Keyword If '${loginType}' == 'api' ApiLogoutAndDelLocalIP aa
... ELSE IF '${loginType}' == 'cli' CliLogout
... ELSE UiLogoutAndDelLocalIP bb

View File

@@ -0,0 +1,43 @@
*** Settings ***
Library Smtp3Library
*** Keywords ***
EmailLogin
[Arguments] ${SURL} ${SPORT} ${SUSER} ${SPWD}
[Documentation] [${SURL}:邮箱发送服务器比如腾讯企业邮箱smtp.exmail.qq.com;qq邮箱smtp.qq.com;163邮箱smtp.163.com等]
... [${SPORT}邮箱发送服务器的端口无论是哪种邮箱的一般是25该值可灵活填充]
... [${SUSER}:邮箱登入用户名,无需转码]
... [${SPWD}:登入密码。对于腾讯企业邮箱密码无变化qq邮箱需要第三方授权码登入163邮箱需要第三方授权码登入]
... [关键字返回值这是163邮箱的返回结果不同邮箱可能不太一样(235, b'Authentication successful')]
[Tags] function email send
Prepare Connection ${SURL} ${SPORT} ${SUSER} ${SPWD}
Connect
Ehlo
${result} logins
run keyword if "${result}"=="fail" log ${result}
... ELSE Quit Close Connection
#Quit
#Close Connection
[Return] ${result} # 返回登入结果
EmailSendFull
[Arguments] ${SURL} ${SPORT} ${SUSER} ${PWD} ${SUBJ} ${FROM} ${to} ${cc} ${bcc} ${Sbody} ${attach}
[Documentation] [注意:所有参数都是必填参数]
... [${SURL}:邮箱发送服务器比如smtp.qq.com]
... [${SPORT}:邮箱服务器写法如25]
... [${SUSER}:登入名zhangsan@qq.com]
... [${PWD}:登入密码不同类型的邮箱登入密码需求不一样具体看EmailLogin关键字对于密码的要求]
... [${SUBJ}主题111111]
... [${FROM} :发送者例如zhangsan@qq.com]
... [ ${to} :接收者,可以写多个,写法例如:["lisi@qq.com","wangwu@163.com"] ,若写单个接收者["lisi@qq.com"] ]
... [${cc}:抄送者。可以写多个,写法同${to}]
... [${bcc}:密送者。可以写多个,写法同${to}]
... [${Sbody}:邮件正文写法如1234teacher]
... [${attach}:附件文本,可以写多个,注意本地是否有这些文件。写法如:["1.txt","E://abc.txt"]]
... [关键字返回值:发送成功会返回{},空的内容]
[Tags] function email send
Prepare Connection ${SURL} ${SPORT} ${SUSER} ${PWD}
${send_result} Send Message With All Parameters ${SURL} ${SUSER} ${PWD} ${SUBJ} ${FROM} ${to} ${cc} ${bcc} ${Sbody} ${attach}
Comment Send Message
Close Connection
[Return] ${send_result} # 返回发送邮件结果

View File

@@ -0,0 +1,94 @@
*** Settings ***
Library FtpLibrary
*** Keywords ***
checkFTPRecvReport
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${fpath} ${filename}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
... [fpath要写ftp服务器的绝对路径写法例如/a/b/20200110/]
... [filename,是指系统下发report时对report起的名字在这里判断方法是ftp文件名称是否包含report名称所以在TSG系统上下发report时应尽量不要用重名以免判断失误写法例如长安街]
... [注意:该关键字无返回值,他是等同于一个用例,若字符串不包含则表示用例执行失败,会有相关信息打印]
[Tags] function FTP reportResult
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
sleep 1
cwd ${fpath}
sleep 1
@{dirname} Dir Names
sleep 1
${Strdirname} Evaluate ''.join(@{dirname})
Should Contain ${Strdirname} ${filename}
ftp close
FTPDownloadFile
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPath} ${SrcName} ${dstPathName}
[Documentation] [fUrl是FTP服务器地址例如:192.168.1.1]
... [fport是ftp服务器的端口号例如21]
... [fuser是用户名例如wxs]
... [fpwd是密码例如wqqq]
... [SrcPath是ftp服务器上的要下载的文件的路径文件包名称必须写例如/a/b/]
... [SrcName是ftp服务器上的要下载的文件名称文件名称不要太复杂(不要包含符号)否则无法识别例如teacher王.txt]
... [dstPathName是下载到本地时的本地路径名+名称名称可不写建议不写下载到本地的名称就会与FTP上文件一样写法1. D:/rfftppy/tmp/ 2.D:/rfftppy/tmp/b.txt \]
[Tags] function FTP downloadFile
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
cwd ${SrcPath}
sleep 1
download file ${SrcName} ${dstPathName}
ftp close
FTPUploadFileToTest
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPathName}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
... [SrcPathName,本地待上传的文件的路径名例如E:/qqq.txt]
... [注意该关键字默认上传到ftp服务器的/test目录下若test目录不存在会自己创建]
[Tags] function FTP uploadFileToTest
${intest} Set Variable test
Run Keyword If '${fport}'!='21' Run Keyword Log 请注意FTP服务器端口号不是21默认端口号请继续登入
... AND Log 登入中...
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
@{dirnames} Dir Names
${result} checkListContainStirng ${intest} @{dirnames}
log ${SrcPathName}
Run Keyword If '${result}'=='${intest}' log /test目录存在
... ELSE Run Keyword log /test目录不存在已创建并上传文件
... AND Mkd ${intest}
Cwd ${intest}
Comment @{aa} Dir Names
Upload File ${SrcPathName}
checkListContainStirng
[Arguments] ${str} @{strlist}
FOR ${value} IN @{strlist}
Log ${value}
Return From Keyword If '${value}'=='${str}' ${value}
END
Return From Keyword ${value}
FTPUploadFile
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd} ${SrcPathName}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
... [SrcPathName,本地待上传的文件的路径名例如E:/qqq.txt]
... [注意该关键字默认上传到ftp服务器的root目录下]
[Tags] function FTP uploadFile
Run Keyword If '${fport}'!='21' Run Keyword Log 请注意FTP服务器端口号不是21默认端口号请继续登入
... AND Log 登入中...
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
Upload File ${SrcPathName}
FTPLogin
[Arguments] ${fURL} ${fport} ${fuser} ${fpwd}
[Documentation] [fURL写法例如:192.168.1.1]
... [fport写法例如21]
... [fuser写法例如wxs]
... [fpwd要写ftp服务器的密码写法例如111111]
[Tags] function FTP login
Ftp Connect ${fURL} ${fuser} ${fpwd} ${fport}
Get Welcome

View File

@@ -0,0 +1,259 @@
*** Settings ***
Documentation 写用例的话,直接调用关键字,输入关键字参数的值。
... 例如想查询时间为2020-02-24 00:00:00 到2020-02-25 00:00:00 \ 的policy id为2409的log
... 1、创建一个case
... 2、输入关键字Security Event Logs
... 3、输入必填参数的值根据关键字里的要求填入相对应的值
... 必填参数:${time1} | ${time2} | ${type1} | ${value} | ${element1}
... ${time1}:为开始时间 \ ${time2}:为结束时间
... ${type1}:为要查询的类型
... ${value}:要查询的内容
... ${element1}:想要获取信息的定位元素
...
... 4、直接运行该case
Library Selenium2Library
Library ExcelLibrary
*** Keywords ***
click
[Arguments] ${element}
Click Element ${element}
input
[Arguments] ${element} ${text}
Input Text ${element} ${text}
ui-login
Open Browser http://192.168.40.120 Chrome
input xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input lyf
input xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input 111111
click xpath=//*[@id="app"]/div/div[2]/div/div[4]/button
ui-logout
Close Browser
Security Event Logs
[Arguments] ${time1} ${time2} ${type1} ${value} ${element1}
#打开浏览器
#TSG-登录 lyf 111111
Sleep 1
click id=children2 #点击一级目录log
Sleep 1
click id=sidebarLog_SecurityEventLogs #点击二级目录Security Event Logs
sleep 1
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
sleep 1
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] #清空输入框
sleep 1
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] #清空输入框
sleep 1
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
click xpath=/html/body/div/div[2]/button[2]
sleep 1
click id=one-input
sleep 1
click ${type1} #选择要查询的类型
sleep 1
input id=sreach_input ${value} #在输入框输入查询数据
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
sleep 2
${result1} ${text2} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
sleep 1
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[7]/div/ul/li[1]/span
# Evaluate ${text3}.replace('','Total: ')
${t} Convert To Integer ${text3}
${a1} Evaluate ${t}%20 #求余
${t1}= Evaluate math.ceil(${t}/20) math #求整如果有余数会得出整数加1
${t2} Evaluate ${t1}+1
: FOR ${j} IN RANGE 1 ${t2}
\ ForSElog ${element1} ${j} ${t1} ${a1}
\ click xpath=//*[@id="zhumingmingPageRight"]/i
#关闭浏览器
text
sleep 2
${text1} Get Text xpath=/html/body/div/div/div[3]/button/span
ForSElog
[Arguments] ${element} ${j} ${t1} ${a1}
: FOR ${i} IN RANGE 1 21
\ log ${i}
\ click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[${i}]/td[3]
\ sleep 2
\ ${text4} Get text ${element}
\ log ${text4}
\ click id=securityEvent_logIdClose
\ run keyword if '${j}'=='${t1}' log yes
\ IF1 ${i} ${a1}
IF1
[Arguments] ${i} ${a2}
run keyword if '${i}'=='${a2}' Exit For Loop
Proxy Event Logs
[Arguments] ${time1} ${time2} ${type1} ${value} ${element1}
#打开浏览器
#TSG-登录 lyf 111111
Sleep 1
click id=children2 #点击一级目录log
Sleep 1
click id=sidebarLog_ProxyEventLogs #点击二级目录ProxyEventLogs
sleep 1
${result} ${text1} Run Keyword And Ignore Error text1 #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
#click xpath=/html/body/div/div/div[3]/button
Clear Element Text id=d #清空输入框
sleep 1
input id=d ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
Clear Element Text id=a #清空输入框
sleep 1
input id=a ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
click xpath=/html/body/div/div[2]/button[2] #点击时间组件的ok按钮
sleep 1
click id=one-input #点击查询输入框
sleep 1
click ${type1} #选择要查询的类型
sleep 1
input id=sreach_input ${value} #在输入框输入查询数据
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
sleep 2
${result1} ${text2} Run Keyword And Ignore Error text1 #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
sleep 1
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[7]/div/ul/li[1]/span #获取列表数量
# Evaluate ${text3}.replace('','Total: ')
${t} Convert To Integer ${text3} #text转换为int
${a1} Evaluate ${t}%20 #求余
${t1}= Evaluate math.ceil(${t}/20) math #求整如果有余数会得出整数加1
${t2} Evaluate ${t1}+1
: FOR ${j} IN RANGE 1 ${t2}
ForPElog ${element1} ${j} ${t1} ${a1}
click xpath=//*[@id="zhumingmingPageRight"]/i #点击翻页
#关闭浏览器
text1
sleep 2
${text1} Get Text xpath=/html/body/div[3]/div/div[3]/button/span
SE logs-Export
[Arguments] ${time1} ${time2} ${type1} ${value} ${file}
#打开浏览器
#TSG-登录 lyf 111111
Sleep 1
click id=children2 #点击一级目录log
Sleep 1
click id=sidebarLog_SecurityEventLogs #点击二级目录Security Event Logs
sleep 1
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
#click xpath=/html/body/div[2]/div/div[3]/button
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] #清空输入框
sleep 1
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] #清空输入框
sleep 1
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
click xpath=/html/body/div/div[2]/button[2]
sleep 1
click id=one-input
sleep 1
click ${type1} #选择要查询的类型
sleep 1
input id=sreach_input ${value} #在输入框输入查询数据
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
sleep 2
${result1} ${text2} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' ui-logout else log 有数据
sleep 1
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[7]/div/ul/li[1]/span
${t} Convert To Integer ${text3}
click xpath=//*[@id="log_securityEventExport"]/i
sleep 20
Open Excel ${file} #打开Excel表
sleep 2
${row} Get Row Count Sheet1 #获取Excel表的行数
Should Be Equal As Numbers ${row} ${t} #断言 \ 获取到的log列表数量和获取到的Excel表的行数对比
PE Logs-Export
Session Records
[Arguments] ${time1} ${time2} ${type1} ${value} ${element1}
#打开浏览器
#TSG-登录 lyf 111111
Sleep 1
click id=children2 #点击一级目录log
Sleep 1
click id=sidebarLog_SesssionRecords #点击二级目录Session Records
sleep 1
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
# xpath=/html/body/div[2]/div/div[3]/button
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] #清空输入框
sleep 1
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[1] ${time1} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] #清空输入框
sleep 1
input xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/input[2] ${time2} #在输入框里输入时间 \ 格式为2020-02-24 18:21:01
sleep 1
click xpath=/html/body/div/div[2]/button[2]
sleep 1
${result} ${text1} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
click id=one-input
sleep 1
click ${type1} #选择要查询的类型
sleep 1
input id=sreach_input ${value} #在输入框输入查询数据
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div/div[2] #点击搜索按钮
sleep 2
${result1} ${text2} Run Keyword And Ignore Error text #获取弹出框文本,进行异常处理
run keyword if '${result}'=='Pass' run keywords click xpath=/html/body/div/div/div[3]/button
sleep 1
${text3} Get text xpath=//*[@id="app"]/div/div[3]/div/div/div[6]/div/ul/li[1]/span
# Evaluate ${text3}.replace('','Total: ')
${t} Convert To Integer ${text3}
${a1} Evaluate ${t}%20 #求余
${t1}= Evaluate math.ceil(${t}/20) math #求整如果有余数会得出整数加1
${t2} Evaluate ${t1}+1
: FOR ${j} IN RANGE 1 ${t2}
ForSR ${element1} ${j} ${t1} ${a1}
click xpath=//*[@id="zhumingmingPageRight"]/i
#关闭浏览器
ForPElog
[Arguments] ${element} ${j} ${t1} ${a1}
: FOR ${i} IN RANGE 1 21
\ log ${i}
\ click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[${i}]/td[3]
\ sleep 2
\ ${text4} Get text ${element}
\ log ${text4}
\ click id=proxyEvent_logIdClose
\ run keyword if '${j}'=='${t1}' log yes
\ IF1 ${i} ${a1}
ForSR
[Arguments] ${element} ${j} ${t1} ${a1}
: FOR ${i} IN RANGE 1 21
\ log ${i}
\ click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[${i}]/td[3]
\ sleep 2
\ ${text4} Get text ${element}
\ log ${text4}
\ click id=sessionRecords_logIdClose
\ run keyword if '${j}'=='${t1}' log yes
\ IF1 ${i} ${a1}

View File

@@ -0,0 +1,26 @@
*** Settings ***
Library Selenium2Library
Resource ../../../03-Variable/BifangApiVariable.txt
Library Selenium2Library
Resource ../Objects/Objects.robot
Resource ../Objects/ObjectPages.robot
*** Keywords ***
Login
Open Browser http://${host}/#/login ${browserType}
Maximize Browser Window
input text xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input ${username}
input text xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input ${password}
Click button id=login
AddLocalIp
${obj1} create dictionary type=Ip name=LocahIPName ipads=${ipType} ipclient=masks ipclienttext1=${testClentIP} ipclienttext2=${ipMask}
CreatePage ${obj1}[type] ${obj1}[name] ipads=${obj1}[ipads] ipclient=${obj1}[ipclient] ipclienttext1=${obj1}[ipclienttext1] ipclienttext2=${obj1}[ipclienttext2]
set global variable ${LocahIPName} ${obj1}[name]
UiLoginAndAaddLocalIP
[Arguments] ${tempParm}
log UiLoginAndAaddLocalIP${tempParm}
Login.Login
Run Keyword If ${addTestClentIPFlag}==1 AddLocalIp
log UiLoginAndAaddLocalIP:${LocahIPName}

View File

@@ -0,0 +1,17 @@
*** Settings ***
Library Selenium2Library
Resource ../Objects/ObjectPages.robot
*** Keywords ***
Logout
Mouse Hover xpath=//*[@id="app"]/div/div[1]/div[2]/div/span/div/span
sleep 0.5
click element xpath=//div[@class='SignOut']
sleep 2
Close All Browsers
UiLogoutAndDelLocalIP
[Arguments] ${tempParm}
log UiLogoutAndDelLocalIP${tempParm}
Objects.DeletePage ${LocahIPName}
Logout.Logout

View File

@@ -0,0 +1,23 @@
*** Settings ***
Library Selenium2Library
*** Keywords ***
Menu
[Arguments] ${menuOne} ${menuTwo}
Wait Until Element Is Enabled id=routerEvent0
# 一级菜单
${dict} create dictionary dashboard=routerEvent0 policy&objects=children1 log=children2 report=children3 device=children4 settings=children5 administartion=children6
# 二级菜单
${policy&objects} create dictionary Security Policy=sidebarObjects_ProxyInterception Proxy Policy=sidebarObjects_ProxyManipulation Objects=sidebarObjects_Objects Schedules=sidebarObjects_Schedule Tags=sidebarObjects_Tags
${log} create dictionary Security Event Logs=sidebarLog_SecurityEventLogs Proxy Event Logs=sidebarLog_ProxyEventLogs Session Records=sidebarLog_SesssionRecords Radius Logs=sidebarLog_RadiusLogs
# 遍历一级菜单
FOR ${list} ${num} IN ENUMERATE @{dict}
run keyword if "${num}"=="${menuOne}" run keywords sleep 5
... AND click element id=${dict}[${num}]
END
# 遍历二级菜单
FOR ${list} ${num} IN ENUMERATE @{${menuOne}}
run keyword if "${num}"=="dashboard" Exit For Loop
... ELSE IF "${num}"=="${menuTwo}" run keywords sleep 3
... AND click element id=${${menuOne}}[${num}]
END

View File

@@ -0,0 +1,71 @@
*** Settings ***
Library Selenium2Library
Resource Objects.robot
Resource ../Menu.robot
Library Collections
*** Keywords ***
CreatePage
[Arguments] ${objtype} ${name} ${ipads}=null ${ipclient}=null ${ipclienttext1}=null ${ipclienttext2}=null ${keywordtext}=null ${hex}=close ${reqrestype}=null ${reqresheader}=null
Menu policy&objects Objects
sleep 3
Objects.CreateButton ${objtype}
Objects.Create-name ${name}
Objects.Create-item
run keyword if "${objtype}"=="Ip" run keywords Objects.Create-ip-AddressType ${ipads}
... AND Objects.Create-ip-ClientIP ${ipclient}
... AND Objects.Create-ip-ClientIP-text ${ipclient} ${ipclienttext1} ${ipclienttext2}
run keyword if "${objtype}"=="Fqdn" or "${objtype}"=="Sub" or "${objtype}"=="Url" or "${objtype}"=="Category" or "${objtype}"=="Account" run keywords Objects.Create-keyword-text ${objtype} ${keywordtext}
... AND sleep 1
run keyword if '${objtype}'=='Key' run keywords Objects.Create-Key-text ${keywordtext}
... AND Objects.Create-Key-hexmode ${hex}
run keyword if '${objtype}'=='ReqRes' run keywords Objects.Create-ReqRes-type ${reqrestype}
... AND Objects.Create-ReqRes-header ${reqrestype} ${reqresheader}
... AND Objects.Create-ReqRes-text ${keywordtext}
... AND Objects.Create-ReqRes-hexmode ${hex}
Objects.Create-item-ok ${objtype}
Objects.Create-ok
UpdateIPPage
SelectOne
UpButton
UpName yyq_test_up
Create-item
Create-ip-ClientIP range
Create-ip-ClientIP-text 192.168.255.255 192.168.255.255
Create-item-ok Ip #Ip
UpOk
DeletePage
[Arguments] ${name}
sleep 1
click element id=clear_input_btm
sleep 1
input text id=one-input ${name}
press keys id=one-input ENTER
Objects.SelectOne
Objects.DeleteButton
Objects.Delete-delete
UploadPage
UploadButton
Upload-name yyq-uploadFile
Upload-objectType
Upload-uploadedFile F:\\yyq\\python\\ip_20200221080650.txt
Upload-ok
ExportPage
ExportPage
Export-objectType ip
Export-format txt
Export-ok
DeleteObjects
[Arguments] ${obj}
sleep 2
Menu policy&objects Objects
FOR ${num} ${key} IN ENUMERATE @{obj}
sleep 2
run keyword if "${key}"!="Ip" DeletePage ${obj}[${key}]
sleep 1
END

View File

@@ -0,0 +1,256 @@
*** Settings ***
Library Selenium2Library
*** Keywords ***
CreateButton
[Arguments] ${objType}
Wait Until Element Is Enabled id=objectCreate
sleep 3
Click element id=objectCreate
run keyword if "${objType}"=="Ip" run keywords sleep 2
... AND Click element id=object1
... ELSE IF "${objType}"=="Fqdn" run keywords sleep 2
... AND Click element id=object2
... ELSE IF "${objType}"=="Sub" run keywords sleep 2
... AND Click element id=object3
... ELSE IF "${objType}"=="ReqRes" run keywords sleep 2
... AND Click element id=object4
... ELSE IF "${objType}"=="Key" run keywords sleep 2
... AND Click element id=object5
... ELSE IF "${objType}"=="Url" run keywords sleep 2
... AND Click element id=object6
... ELSE IF "${objType}"=="Category" run keywords sleep 2
... AND Click element id=object7
... ELSE IF "${objType}"=="Account" run keywords sleep 2
... AND Click element id=object8
... ELSE IF log 对象类型有误
Create-name
[Arguments] ${objName}
sleep 2
input text id=objectAdd_name ${objName}
Create-item
click element id=objectAddItemAdd
Create-item-Add
[Arguments] ${Type}
click element id=objectAddItem${Type}Add
Create-item-ok
[Arguments] ${Type}
sleep 2
run keyword if "${Type}"=="Category" click element id=objectAddItemFqdnOk
... ELSE IF "${Type}"=="Account" click element id=objectItemAccountOk
... ELSE click element id=objectAddItem${Type}Ok
Create-item-Cancel
[Arguments] ${Type}
click button id=objectAddItem${Type}Cancel
Create-ip-AddressType
[Arguments] ${AdsType}
sleep 2
click element id=objectItemIpType0
sleep 2
run keyword if "${AdsType}"=="ipv4" run keywords click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[1]
... AND sleep 1
... ELSE IF "${AdsType}"=="ipv6" run keywords click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[2]
... ELSE run keywords log 'Address Type错误'
Create-ip-Protocol
[Arguments] ${Protocol}
run keyword if ${Protocol}=="any" click element id=objectItemIpProtocol10
... ELSE IF ${Protocol}=="tcp" click element id=objectItemIpProtocol20
... ELSE IF ${Protocol}=="udp" click element id=objectItemIpProtocol30
Create-ip-Directed
[Arguments] ${Directed}
run keyword if ${Directed}=="no" click element id=objectItemIpDirection10
... ELSE IF ${Directed}=="yes" click element id=objectItemIpDirection20
Create-ip-ClientIP
[Arguments] ${clientIPType}
sleep 2
click element id=object_ip_sourecip0
sleep 2
run keyword if "${clientIPType}"=="range" run keywords sleep 1
... AND click element id=range0
... ELSE IF "${clientIPType}"=="cidr" run keywords sleep 1
... AND click element id=CIDR0
... ELSE IF "${clientIPType}"=="masks" run keywords sleep 1
... AND click element xpath=/html/body/div[3]/div[1]/div[1]/ul/li[3]
sleep 2
Create-ip-ClientIP-text
[Arguments] ${clientIPType} ${clientIPStart} ${clientIPEnd}
sleep 2
run keyword if "${clientIPType}"=="range" run keywords input text id=object_ip_clientip10 ${clientIPStart}
... AND input text id=object_ip_clientip20 ${clientIPEnd}
run keyword if "${clientIPType}"=="cidr" run keywords input text id=object_ip_clientip30 ${clientIPStart}
... AND input text id=object_ip_clientip40 ${clientIPEnd}
run keyword if "${clientIPType}"=="masks" run keywords input text id=object_ip_clientip50 ${clientIPStart}
... AND input text id=object_ip_clientip60 ${clientIPEnd}
Create-ip-ClientPort
Create-ip-ClientPort-text
Create-ip-ServerIP
Create-ip-ServerPort
Create-subobjects
click element id=objectAddSubAdd
Create-Description
[Arguments] ${objDesc}
input text id=objectAdd_description ${objDesc}
Create-ok
sleep 1
click button id=objectAdd_ok
Create-cancel
click button id=objectAdd_cancel
SelectOne
sleep 3
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]
UpButton
click button id=objectEdit
DeleteButton
click button id=objectDel
Delete-delete
sleep 2
click button id=object-objectDel-confirm
Delete-cancel
click button xpath=/html/body/div[2]/div/div[3]/button[1]
UpName
[Arguments] ${name}
clear element text id=objectAdd_name
input text id=objectAdd_name ${name}
UpOk
click button id=objectAdd_ok
UploadButton
sleep 3
click button id=objectImprt
ExportButton
sleep 3
click button id=objectExport
Upload-name
[Arguments] ${name}
sleep 2
input text xpath=//*[@id="app"]/div/div[3]/div/div/div[14]/div/div[1]/div[1]/div/input ${name}
Upload-objectType
click button id=object_select_Import
sleep 2
click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[1]
Upload-uploadedFile
[Arguments] ${ads}
sleep 3
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[14]/div/div[2]/div/div[1]/input ${ads}
Upload-ok
click button id=objectUploadedOk
Export-objectType
[Arguments] ${objType}
click element id=object_select_Import1
run keyword if "${objType}"=="ip" run keywords sleep 2
... AND click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[1]
... ELSE IF "${objType}"=="fqdn" run keywords sleep 2
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[2]
... ELSE IF "${objType}"=="subscriberid" run keywords sleep 2
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[3]
... ELSE IF "${objType}"=="httpsignature" run keywords sleep 2
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[4]
... ELSE IF "${objType}"=="keywords" run keywords sleep 2
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[5]
... ELSE IF "${objType}"=="url" run keywords sleep 2
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[6]
... ELSE IF "${objType}"=="category" run keywords sleep 2
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[7]
... ELSE IF "${objType}"=="account" run keywords sleep 2
... AND Click element xpath=/html/body/div[2]/div[1]/div[1]/ul/li[8]
Export-format
[Arguments] ${filetype}
sleep 2
click element id=object_select_export
run keyword if "${filetype}"=="txt" run keywords sleep 2
... AND click element xpath=/html/body/div[3]/div[1]/div[1]/ul/li[1]
... ELSE IF "${filetype}"=="csv" run keywords sleep 2
... AND click element xpath=/html/body/div[3]/div[1]/div[1]/ul/li[2]
Export-ok
click button id=objectImportOk
Export-cancel
click button id=objectImportCancel
Create-keyword-text
[Arguments] ${type} ${keywordtext}
sleep 1
run keyword if "${type}"=="Fqdn" run keywords sleep 1
... AND input text id=object_fqdn0 ${keywordtext}
... ELSE IF "${type}"=="Sub" run keywords sleep 1
... AND input text id=object_sub0 ${keywordtext}
... ELSE IF "${type}"=="Url" run keywords sleep 1
... AND input text id=object_url0 ${keywordtext}
... ELSE IF "${type}"=="Category" run keywords sleep 1
... AND input text id=object_fqdn0 ${keywordtext}
... ELSE IF "${type}"=="Account" run keywords sleep 1
... AND input text id=object_account0 ${keywordtext}
... ELSE log 2
Create-ReqRes-type
[Arguments] ${type}
sleep 1
run keyword if '${type}'=='req' click element xpath=//*[@id="objectAddItemReqRes"]/label[1]
... ELSE IF '${type}'=='res' click element xpath=//*[@id="objectAddItemReqRes"]/label[2]
sleep 1
Create-ReqRes-header
[Arguments] ${type} ${header}
sleep 1
run keyword if '${type}'=='req' and '${header}'=='ua' click element xpath=//*[@id="objectAddItemReqResType1"]/label[1]
... ELSE IF '${type}'=='req' and '${header}'=='ck' click element xpath=//*[@id="objectAddItemReqResType1"]/label[2]
... ELSE IF '${type}'=='res'and '${header}'=='sck' click element xpath=//*[@id="objectAddItemReqResType"]/label[1]
... ELSE IF '${type}'=='res'and '${header}'=='ct' click element xpath=//*[@id="objectAddItemReqResType"]/label[2]
sleep 1
Create-ReqRes-text
[Arguments] ${keywordtext}
sleep 1
input text id=object_sig0 ${keywordtext}
sleep 1
Create-ReqRes-hexmode
[Arguments] ${hex}
sleep 1
run keyword if "${hex}"=="open" click element id=objectAddItemReqResIsHexbin0_swith
sleep 1
Create-Key-text
[Arguments] ${keywordtext}
sleep 1
input text id=object_key0 ${keywordtext}
sleep 1
Create-Key-hexmode
[Arguments] ${hex}
sleep 1
run keyword if "${hex}"=="open" click element id=objectAddItemKeyIsHexbin0_swith
sleep 1

View File

@@ -0,0 +1,260 @@
*** Settings ***
Library Selenium2Library
*** Keywords ***
Schedules-create
[Arguments] ${name} ${type1} ${number} ${weeks} ${dateorweeks} ${dates}
... ${aweeks} ${Start Date} ${End Date} ${Start Time} ${End Time}
click element id=scheduleAdd #点击create按钮
sleep 1
input text id=schedule_name ${name}
sleep 1
${type} set variable ${type1}
run keyword if '${type}'=='Daily' run keywords sleep 1
... AND Schedules-Daily ${number}
... ELSE IF '${type}'=='Weekly' run keywords sleep 1
... AND Schedules-Weekly ${number} ${weeks}
... ELSE IF '${type}'=='Monthly' run keywords sleep 1
... AND Schedules-Monthly ${dateorweeks} ${number} ${dates} ${aweeks}
... ${weeks}
... ELSE IF '${type}'=='One-time' run keywords sleep 1
... AND click element id=scheduleAddTypeSingle
sleep 1
input text id=schedulead_startdate ${Start Date} #开始日期
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 1
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[5]/div/div/input ${End Date} #结束日期
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 1
input text id=schedulead_startTime ${Start Time} #开始时间
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 1
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[7]/div/div/input ${End Time} #结束时间
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 2
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[8]/div/div/button[1] #点击OK
sleep 2
Schedules-Daily
[Arguments] ${number}
click element id=scheduleAddTypeDaily #点击 Daily
sleep 1
input text xpath=//*[@id="schedule_interval"]/div/input ${number}
sleep 1
Schedules-Weekly
[Arguments] ${number} ${weeks}
click element id=scheduleAddTypeWeekly #点击Weekly
sleep 1
input text xpath=//*[@id="schedule_interval"]/div/input ${number}
sleep 1
${week} set variable ${weeks}
run keyword if '${week}'=='SUN' run keywords sleep 1
... AND click element id=schedulead_cities0
... ELSE IF '${week}'=='MON' run keywords sleep 1
... AND click element id=schedulead_cities1
... ELSE IF '${week}'=='TUE' run keywords sleep 1
... AND click element id=schedulead_cities2
... ELSE IF '${week}'=='WED' run keywords sleep 1
... AND click element id=schedulead_cities3
... ELSE IF '${week}'=='THU' run keywords sleep 1
... AND click element id=schedulead_cities4
... ELSE IF '${week}'=='FRI' run keywords sleep 1
... AND click element id=schedulead_cities5
... ELSE IF '${week}'=='SAT' run keywords sleep 1
... AND click element id=schedulead_cities6
sleep 1
Schedules-Monthly
[Arguments] ${dateorweeks} ${number}=null ${dates}=null ${aweeks}=null ${weeks}=null
click element id=scheduleAddTypeMonthly #点击monthly
sleep 1
${dateorweek} set variable ${dateorweeks}
run keyword if '${dateorweek}'=='Date' run keywords sleep 1
... AND click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[3]/div/div[1]/label[1]
... AND Schedules-Monthly-Date ${number} ${dates}
... ELSE IF '${dateorweek}'=='Week' run keywords sleep 1
... AND click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[3]/div/div[1]/label[2]
... AND Schedules-Monthly-Week ${number} ${aweeks} ${weeks}
Schedules-Monthly-Date
[Arguments] ${number} ${dates}
input text xpath=//*[@id="schedule_interval"]/div/input ${number}
sleep 1
${date} set variable ${dates}
run keyword if '${date}'=='All' run keywords sleep 1
... AND click element id=schedule_alldaycontrol
... ELSE IF '${date}'=='1' run keywords sleep 1
... AND click element id=schedule_onDay0
... ELSE IF '${date}'=='2' run keywords sleep 1
... AND click element id=schedule_onDay1
... ELSE IF '${date}'=='3' run keywords sleep 1
... AND click element id=schedule_onDay2
... ELSE IF '${date}'=='4' run keywords sleep 1
... AND click element id=schedule_onDay3
... ELSE IF '${date}'=='5' run keywords sleep 1
... AND click element id=schedule_onDay4
... ELSE IF '${date}'=='6' run keywords sleep 1
... AND click element id=schedule_onDay5
... ELSE IF '${date}'=='7' run keywords sleep 1
... AND click element id=schedule_onDay6
... ELSE IF '${date}'=='8' run keywords sleep 1
... AND click element id=schedule_onDay7
... ELSE IF '${date}'=='9' run keywords sleep 1
... AND click element id=schedule_onDay8
... ELSE IF '${date}'=='10' run keywords sleep 1
... AND click element id=schedule_onDay9
... ELSE IF '${date}'=='11' run keywords sleep 1
... AND click element id=schedule_onDay10
... ELSE IF '${date}'=='12' run keywords sleep 1
... AND click element id=schedule_onDay11
... ELSE IF '${date}'=='13' run keywords sleep 1
... AND click element id=schedule_onDay12
... ELSE IF '${date}'=='14' run keywords sleep 1
... AND click element id=schedule_onDay13
... ELSE IF '${date}'=='15' run keywords sleep 1
... AND click element id=schedule_onDay14
... ELSE IF '${date}'=='16' run keywords sleep 1
... AND click element id=schedule_onDay15
... ELSE IF '${date}'=='17' run keywords sleep 1
... AND click element id=schedule_onDay16
... ELSE IF '${date}'=='18' run keywords sleep 1
... AND click element id=schedule_onDay17
... ELSE IF '${date}'=='19' run keywords sleep 1
... AND click element id=schedule_onDay18
... ELSE IF '${date}'=='20' run keywords sleep 1
... AND click element id=schedule_onDay19
... ELSE IF '${date}'=='21' run keywords sleep 1
... AND click element id=schedule_onDay20
... ELSE IF '${date}'=='22' run keywords sleep 1
... AND click element id=schedule_onDay21
... ELSE IF '${date}'=='23' run keywords sleep 1
... AND click element id=schedule_onDay22
... ELSE IF '${date}'=='24' run keywords sleep 1
... AND click element id=schedule_onDay23
... ELSE IF '${date}'=='25' run keywords sleep 1
... AND click element id=schedule_onDay24
... ELSE IF '${date}'=='26' run keywords sleep 1
... AND click element id=schedule_onDay25
... ELSE IF '${date}'=='27' run keywords sleep 1
... AND click element id=schedule_onDay26
... ELSE IF '${date}'=='28' run keywords sleep 1
... AND click element id=schedule_onDay27
... ELSE IF '${date}'=='29' run keywords sleep 1
... AND click element id=schedule_onDay28
... ELSE IF '${date}'=='30' run keywords sleep 1
... AND click element id=schedule_onDay29
... ELSE IF '${date}'=='31' run keywords sleep 1
... AND click element id=schedule_onDay301sleep1
sleep 1
Schedules-Monthly-Week
[Arguments] ${number} ${aweeks} ${weeks}
sleep 2
input text xpath=/html/body/div/div/div[3]/div/div/div/div[2]/form/div[3]/div/div[2]/div/div/div/div/input ${number}
sleep 1
click element id=schedulead_select_week
sleep 2
${aweek} set variable ${aweeks}
run keyword if '${aweek}'=='1' run keywords sleep 1
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[1]
... ELSE IF '${aweek}'=='2' run keywords sleep 1
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[2]
... ELSE IF '${aweek}'=='3' run1 keywords sleep 1
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[3]
... ELSE IF '${aweek}'=='4' run keywords sleep 1
... AND click eleme1nt xpath=/html/body/div/div[1]/div[1]/ul/li[4]
... ELSE IF '${aweek}'=='L' run keywords sleep 1
... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[5]
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[3]/div/div[3]/nav/div/div[2]/span/span/i
sleep 1
${week} set variable ${weeks}
run keyword if '${week}'=='SUN' run keywords sleep 1
... AND click element id=schedulead_cities0
... ELSE IF '${week}'=='MON' run keywords sleep 1
... AND click element id=schedulead_cities1
... ELSE IF '${week}'=='TUE' run keywords sleep 1
... AND click element id=schedulead_cities2
... ELSE IF '${week}'=='WED' run keywords sleep 1
... AND click element id=schedulead_cities3
... ELSE IF '${week}'=='THU' run keywords sleep 1
... AND click element id=schedulead_cities4
... ELSE IF '${week}'=='FRI' run keywords sleep 1
... AND click element id=schedulead_cities5
... ELSE IF '${week}'=='SAT' run keywords sleep 1
... AND click element id=schedulead_cities6
... ELSE IF '${week}'=='All' run keywords sleep 1
... AND click element id=schedulead_weekchooseAll
sleep 1
Schedules-delete
sleep 1
click element id=scheduleDel #点击删除按钮
sleep 1
click element xpath=/html/body/div[2]/div/div[3]/button[2]
Schedules-search-id
[Arguments] ${id}
sleep 1
click element id=one-input
sleep 1
click element id=input_list_li1
sleep 1
input text id=sreach_input ${id}
sleep 1
click element id=select_new_search_btn
sleep 1
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
Schedules-search-name
[Arguments] ${name}
sleep 1
click element id=one-input
sleep 1
click element id=input_list_li2
sleep 1
input text id=sreach_input ${name}
sleep 1
click element id=select_new_search_btn
sleep 1
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
Schedules-edit
[Arguments] ${name} ${type1} ${number} ${weeks} ${dateorweeks} ${dates}
... ${aweeks} ${Start Date} ${End Date} ${Start Time} ${End Time}
click element id=scheduleEdit #点击create按钮
sleep 1
input text id=schedule_name ${name}
sleep 1
${type} set variable ${type1}
run keyword if '${type}'=='Daily' run keywords sleep 1
... AND Schedules-Daily ${number}
... ELSE IF '${type}'=='Weekly' run keywords sleep 1
... AND Schedules-Weekly ${number} ${weeks}
... ELSE IF '${type}'=='Monthly' run keywords sleep 1
... AND Schedules-Monthly ${dateorweeks} ${number} ${dates} ${aweeks}
... ${weeks}
sleep 1
input text id=schedulead_startdate ${Start Date} #开始日期
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 1
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[5]/div/div/input ${End Date} #结束日期
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 1
input text id=schedulead_startTime ${Start Time} #开始时间
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 1
input text xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[7]/div/div/input ${End Time} #结束时间
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]
sleep 1
click element xpath=//*[@id="policy_Manipulation_create5"]/div[2]/form/div[8]/div/div/button[1] #点击OK
Sleep 2

View File

@@ -0,0 +1,122 @@
*** Settings ***
Library Selenium2Library
*** Keywords ***
Keyring-create
[Arguments] ${keyring-name} ${file} ${file1} ${1or2} ${type} ${type1}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${keyring-name}:新建页面name输入框里的内容
... ${file}:上传文件所在本地的路径
... ${file1}:上传文件所在本地的路径
... ${1or2}:填入1 或者其他数值
... ${type}:上传证书类型的元素
... ${type1}:上传证书加密解密算法的元素
click element id=interceptionadd_eventkeying #点击下拉框
sleep 1
click element id=interceptionadd_keyadd #点击+号添加证书
sleep 2
input text id=keyringsadd_name ${keyring-name} #输入证书name
sleep 1
Choose File xpath=//*[@id="proxy"]/div[10]/div/div/div[2]/form/div[2]/div/div/div/input ${file} #上传证书文件
sleep 2
Choose File xpath=//*[@id="proxy"]/div[10]/div/div/div[2]/form/div[4]/div/div/div/input ${file1} #上传证书文件
${select} Set Variable ${1or2}
Run Keyword If '${select}'=='1' click id=keyringsadd_customized
Run Keyword If '${select}'=='1' input id=reissueExpiryDate 10
click element id=certificateType_input #点击下拉框
sleep 1
click element ${type} #选择证书类型
sleep 1
click element id=keyringsadd_publicKeyAlgo #点击下拉框
sleep 1
click element ${type1} #选择加密解密类型
sleep 1
click element id=parentobj_submit #点击ok
Keyring-search
[Arguments] ${name}
[Documentation] 条用此关键字前需要给必填参数:${name}
... ${name}:创建的keyring的name
click element id=tab-0 #点击Keyring
sleep 1
click element id=interceptionadd_eventkeying #点击下拉框
sleep 1
input text id=card_keyringName ${name} #搜索框输入
Sleep 1
Press key id=card_keyringName \\13 #回车键
sleep 1
click element id=card_keylist0 #点击列表
Certificate Checks
[Arguments] ${Type}
[Documentation] 在调用此关键字前,需要添加必填参数${Type}
... ${Type}为Fail-close或者是Pass-through \ \ \ 代表Certificate Checks 里的两个按钮
click element id=tab-1 #点击Certificate Checks
sleep 1
run keyword if "${Type}"=="Fail-close" click element id=card_fileoption0
... ELSE IF "${Type}"=="Pass-through" click element id=card_fileoption1 #选择Fail-close或者pass-through
Dynamic Bypass
[Arguments] ${Type}
[Documentation] 调用此关键字前 需要给一个必填参数${Type}
... ${Type}参数为EV或者CT或者MA或者OPE或者CP \ 对应Dynamic Bypass 五个按钮
click element id=tab-3 #点击Dynamic Bypass
sleep 1
click element id=mutual_authentication_swith
sleep 1
click element id=undefined_swith
sleep 1
click element id=cert_pinning1_swith
sleep 1
run keyword if "${Type}"=="EV" click element id=ev_cert_swith
... ELSE IF "${Type}"=="CT" click element id=cert_transparency_swith
... ELSE IF "${Type}"=="MA" click element id=mutual_authentication_swith
... ELSE IF "${Type}"=="OPE" click element id=undefined_swith
... ELSE IF "${Type}"=="CP" click element id=cert_pinning1_swith
Certificate Checks-close
[Documentation] 次关键字为关闭Certificate Checks的四个按钮
click element id=tab-1 #点击Certificate Checks
sleep 1
click element id=cn_swith
sleep 1
click element id=issuer_swith
sleep 1
click element id=self_signed_swith
sleep 1
click element id=expiration_swith
Protocol Version
[Arguments] ${Type} ${Type1} ${Type2}
[Documentation] 调用次关键字前需要添加必填参数:
... ${Type}:填入MCV或者AH2
... ${Type1}对应最小版本号填入3.0或者1.0或者1.1或者1.2或者1.3
... ${Type2}对应最大版本号填入3.0或者1.0或者1.1或者1.2或者1.3
click element id=tab-4
sleep 1
run keyword if "${Type}"=="MCV" run keywords click element id=interceptionadd_sslver_swith
... AND Mirror Client Versions-close ${Type1} ${Type2}
... ELSE IF "${Type}"=="AH2" click element id=interceptionaddallhttp_swith
Mirror Client Versions-close
[Arguments] ${Type} ${Type1}
[Documentation] 调用次关键字前需要添加必填参数:
... ${Type}对应最小版本号填入3.0或者1.0或者1.1或者1.2或者1.3
... ${Type1}对应最大版本号填入3.0或者1.0或者1.1或者1.2或者1.3
sleep 1
click element id=interceptionadd_sslmin
sleep 1
run keyword if "${Type}"=="3.0" click element id=pro_min0
... ELSE IF "${Type}"=="1.0" click element id=pro_min1
... ELSE IF "${Type}"=="1.1" click element id=pro_min2
... ELSE IF "${Type}"=="1.2" click element id=pro_min3
... ELSE IF "${Type}"=="1.3" click element id=pro_min4
sleep 1
click element id=interceptionadd_sslmax
sleep 1
run keyword if "${Type1}"=="3.0" click element id=pro_max0
... ELSE IF "${Type1}"=="1.0" click element id=pro_max1
... ELSE IF "${Type1}"=="1.1" click element id=pro_max2
... ELSE IF "${Typeq}"=="1.2" click element id=pro_max3
... ELSE IF "${Typeq}"=="1.3" click element id=pro_max4

View File

@@ -0,0 +1,259 @@
*** Settings ***
Library Selenium2Library
*** Keywords ***
CreateButton
Wait Until Element Is Enabled id=proxyInterception_create
sleep 3
click element id=proxyInterception_create
Create-name
[Arguments] ${name}
sleep 2
input text id=interceptionadd_name ${name}
Create-action
[Arguments] ${action}
run keyword if "${action}"=="allow" run keywords sleep 1
... AND click element id=security_action_Allow
... ELSE IF "${action}"=="deny" run keywords sleep 1
... AND click element id=security_action_Deny
... ELSE IF "${action}"=="monitor" run keywords sleep 1
... AND click element id=security_action_Monitor
... ELSE IF "${action}"=="intercept" run keywords sleep 1
... AND click element id=security_action_Intercept
Create-Conditions
sleep 2
click element id=interceptionadd_object
Create-Conditions-ip
[Arguments] ${objname}
sleep 2
click element id=interceptionadd_procolall1
sleep 2
SecurityPolicy.SelectOne ${objname}
Create-Conditions-sub
[Arguments] ${objname}
sleep 2
click element id=interceptionadd_procolall2
sleep 2
SecurityPolicy.SelectOne ${objname}
Create-Conditions-protocol
[Arguments] ${protocol}
sleep 2
click element id=interceptionadd_procolall3
sleep 2
run keyword if '${protocol}'=='http' run keywords sleep 1
... AND click element id=interceptionadd_prochange0
... ELSE IF '${protocol}'=='ssl' run keywords sleep 1
... AND click element id=interceptionadd_prochange1
... ELSE IF '${protocol}'=='dns' run keywords sleep 1
... AND click element id=interceptionadd_prochange2
... ELSE IF '${protocol}'=='mail' run keywords sleep 1
... AND click element id=interceptionadd_prochange3
... ELSE IF '${protocol}'=='ftp' run keywords sleep 1
... AND click element id=interceptionadd_prochange4
... ELSE log 协议内容错误
Create-Conditions-Search
[Arguments] ${Search}
input text xpath=//*[@id="proxy"]/div[5]/div[2]/div[2]/div/div[1]/input ${Search}
sleep 2
Create-Conditions-Close
click button id=interceptionadd_allcancelobject
sleep 2
Create-Tag
Create-EffectiveDevices
Create-Schedule
Create-Log Session
Create-Description
Create-Enabled
[Arguments] ${state}
sleep 2
run keyword if "${state}"=="open" run keywords click element id=enablencheck_swith
... AND sleep 2
... AND click button id=interceptionadd-enable-confirm
Create-ok
execute javascript document.documentElement.scrollTop=1000
sleep 2
click button id=interceptionadd_sub
sleep 1
execute javascript document.documentElement.scrollTop=0
Create-cancel
click button id=interceptionadd_back
Create-Conditions-obj
[Arguments] ${action} ${protocol} ${objtype} ${objname} ${objtype1}=null
run keyword if '${action}'=='allow' and '${protocol}'=='http' run keywords sleep 1
... AND click element id=interceptionadd_prochange0
... AND Create-Conditions-allow&intercept-http ${objtype} ${objname}
... ELSE IF '${action}'=='intercept' and '${protocol}'=='http' run keywords sleep 1
... AND click element id=interceptionadd_prochange0
... AND Create-Conditions-allow&intercept-http ${objtype} ${objname}
... ELSE IF '${action}'=='allow' and '${protocol}'=='ssl' run keywords sleep 1
... AND click element id=interceptionadd_prochange1
... AND Create-Conditions-allow&intercept-ssl ${objtype} ${objname}
... ELSE IF '${action}'=='intercept' and '${protocol}'=='ssl' run keywords sleep 1
... AND click element id=interceptionadd_prochange1
... AND Create-Conditions-allow&intercept-ssl ${objtype} ${objname}
... ELSE IF '${action}'=='deny' and '${protocol}'=='http' run keywords sleep 1
... AND click element id=interceptionadd_prochange0
... AND Create-Conditions-deny&monitor-http ${objtype} ${objname}
... ELSE IF '${action}'=='monitor' and '${protocol}'=='http' run keywords sleep 1
... AND click element id=interceptionadd_prochange0
... AND Create-Conditions-deny&monitor-http ${objtype} ${objname}
... ELSE IF '${action}'=='deny' and '${protocol}'=='ssl' run keywords sleep 1
... AND click element id=interceptionadd_prochange1
... AND Create-Conditions-deny&monitor-ssl ${objtype1} ${objtype} ${objname}
... ELSE IF '${action}'=='monitor' and '${protocol}'=='ssl' run keywords sleep 1
... AND click element id=interceptionadd_prochange1
... AND Create-Conditions-deny&monitor-ssl ${objtype1} ${objtype} ${objname}
... ELSE IF '${action}'=='deny' and '${protocol}'=='dns' run keywords sleep 1
... AND click element id=interceptionadd_prochange2
... AND Create-Conditions-deny&monitor-dns ${objtype} ${objname}
... ELSE IF '${action}'=='monitor' and '${protocol}'=='dns' run keywords sleep 1
... AND click element id=interceptionadd_prochange2
... AND Create-Conditions-deny&monitor-dns ${objtype} ${objname}
... ELSE IF '${action}'=='deny' and '${protocol}'=='mail' run keywords sleep 1
... AND click element id=interceptionadd_prochange3
... AND Create-Conditions-deny&monitor-mail ${objtype} ${objname}
... ELSE IF '${action}'=='monitor' and '${protocol}'=='mail' run keywords sleep 1
... AND click element id=interceptionadd_prochange3
... AND Create-Conditions-deny&monitor-mail ${objtype} ${objname}
... ELSE IF '${action}'=='deny' and '${protocol}'=='ftp' run keywords sleep 1
... AND click element id=interceptionadd_prochange4
... AND Create-Conditions-deny&monitor-ftp ${objtype} ${objname}
... ELSE IF '${action}'=='monitor' and '${protocol}'=='ftp' run keywords sleep 1
... AND click element id=interceptionadd_prochange4
... AND Create-Conditions-deny&monitor-ftp ${objtype} ${objname}
... ELSE log 对象错误
Create-Conditions-allow&intercept-http
[Arguments] ${objtype} ${objname}
sleep 2
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
... AND sleep 2
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
... AND sleep 2
... ELSE log 对象错误
SecurityPolicy.SelectOne ${objname}
Create-Conditions-allow&intercept-ssl
[Arguments] ${objtype} ${objname}
sleep 2
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
... AND sleep 2
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
... AND sleep 2
... ELSE log 对象错误
SecurityPolicy.SelectOne ${objname}
Create-Conditions-deny&monitor-http
[Arguments] ${objtype} ${objname}
sleep 2
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
... AND sleep 2
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
... AND sleep 2
... ELSE IF '${objtype}'=='Url' run keywords click element id=interceptionadd_pro1
... AND sleep 2
... ELSE IF '${objtype}'=='Reqhdr' run keywords click element id=interceptionadd_pro2
... AND sleep 2
... ELSE IF '${objtype}'=='Reshdr' run keywords click element id=interceptionadd_pro3
... AND sleep 2
... ELSE IF '${objtype}'=='Reqbody' run keywords click element id=interceptionadd_pro4
... AND sleep 2
... ELSE IF '${objtype}'=='Resbody' run keywords click element id=interceptionadd_pro5
... AND sleep 2
... ELSE log 对象错误
SecurityPolicy.SelectOne ${objname}
Create-Conditions-deny&monitor-ssl
[Arguments] ${objtype1} ${objtype} ${objname}
sleep 2
run keyword if '${objtype1}'=='sni' and '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
... AND sleep 2
... ELSE IF '${objtype1}'=='sni' and '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
... AND sleep 2
... ELSE IF ${objtype1}'=='cn' and ${objtype}'=='Fqdn' run keywords click element id=interceptionadd_pro1
... AND sleep 2
... AND click element xpath=//*[@id="interceptionadd_pro1"]/div[2]
... AND sleep 2
... ELSE IF ${objtype1}'=='cn' and${objtype}'=='Category' run keywords click element id=interceptionadd_pro1
... AND sleep 2
... AND click element xpath=//*[@id="interceptionadd_pro1"]/div[3]
... AND sleep 2
... ELSE IF ${objtype1}'=='san' and ${objtype}'=='Fqdn' run keywords click element id=interceptionadd_pro2
... AND sleep 2
... AND click element xpath=//*[@id="interceptionadd_pro2"]/div[2]
... AND sleep 2
... ELSE IF ${objtype1}'=='san' and ${objtype}'=='Category' run keywords click element id=interceptionadd_pro2
... AND sleep 2
... AND click element xpath=//*[@id="interceptionadd_pro2"]/div[3]
... AND sleep 2
... ELSE log 对象错误
SecurityPolicy.SelectOne ${objname}
Create-Conditions-deny&monitor-dns
[Arguments] ${objtype} ${objname}
sleep 2
run keyword if '${objtype}'=='Fqdn' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[2]
... AND sleep 2
... ELSE IF '${objtype}'=='Category' run keywords click element xpath=//*[@id="interceptionadd_pro0"]/div[3]
... AND sleep 2
... ELSE log 对象错误
SecurityPolicy.SelectOne ${objname}
Create-Conditions-deny&monitor-mail
[Arguments] ${objtype} ${objname}
sleep 2
run keyword if '${objtype}'=='Subject' run keywords click element id=interceptionadd_pro0
... AND sleep 2
... ELSE IF '${objtype}'=='Content' run keywords click element id=interceptionadd_pro1
... AND sleep 2
... ELSE IF '${objtype}'=='ATT Name' run keywords click element id=interceptionadd_pro2
... AND sleep 2
... ELSE IF '${objtype}'=='ATT CONT' run keywords click element id=interceptionadd_pro3
... AND sleep 2
... ELSE IF '${objtype}'=='From' run keywords click element id=interceptionadd_pro4
... AND sleep 2
... ELSE IF '${objtype}'=='To' run keywords click element id=interceptionadd_pro5
... AND sleep 2
... ELSE IF '${objtype}'=='Account' run keywords click element id=interceptionadd_pro6
... AND sleep 2
... ELSE log 对象错误
SecurityPolicy.SelectOne ${objname}
Create-Conditions-deny&monitor-ftp
[Arguments] ${objtype} ${objname}
sleep 2
run keyword if '${objtype}'=='url' run keywords click element id=interceptionadd_pro0
... AND sleep 2
... ELSE IF '${objtype}'=='content' run keywords click element id=interceptionadd_pro1
... AND sleep 2
... ELSE IF '${objtype}'=='account' run keywords click element id=interceptionadd_pro2
... AND sleep 2
... ELSE log 对象错误
SecurityPolicy.SelectOne ${objname}
SelectOne
[Arguments] ${objname}
sleep 2
log ${objname}
input text xpath=//*[@id="condistions_protocol"]/div[2]/div[2]/div/div[1]/input ${objname}
sleep 1
press keys xpath=//*[@id="condistions_protocol"]/div[2]/div[2]/div/div[1]/input ENTER
sleep 2
click element xpath=//*[@id="interceptionadd_checkouobject"]/ul/li[1]

View File

@@ -0,0 +1,541 @@
*** Settings ***
Library Selenium2Library
Library E:/Program Files (x86)/Python37-32/Lib/site-packages/robot/libraries/String.py
*** Keywords ***
click
[Arguments] ${element}
Click Element ${element}
input
[Arguments] ${element} ${text}
Input Text ${element} ${text}
ui-logout
Close Browser
ui-login
Open Browser http://192.168.40.120 Chrome
input xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input lyf
input xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input 111111
click xpath=//*[@id="app"]/div/div[2]/div/div[4]/button
Create-Hijack Files
[Arguments] ${name} ${file} ${type}
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=profilesTabs_Profile_HijackFiles #点击Hijack Files按钮
Sleep 1
click id=hijackAdd #点击Create
Sleep 2
input id=hijack_profileName ${name} #输入name
Sleep 2
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[2]/form/div[2]/div/div/div[1]/input ${file} #上传文件
Sleep 2
click id=hijackAddContentType #点击+ 打开侧滑窗口
Sleep 1
click ${type} #选择文件类型
sleep 2
click id=hijackAddOk #点击OK
Sleep 2
input id=one-input ${name} #搜索输入框输入name
Sleep 1
click id=select_new_search_btn #点击搜索按钮
Sleep 1
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/span #获取点击后页面文本信息
Should Be Equal As Strings ${text1} ${name} #断言
Create-Insert Scripts
[Arguments] ${name} ${file} ${type}
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=profilesTabs_Profile_Insert #点击Insert Scripts按钮
Sleep 1
click id=insertAdd #点击Create
Sleep 2
input id=insert_profileName ${name} #输入name
Sleep 2
Choose File xpath=//*[@id="insertAddUpload"]/div[1]/input ${file} #上传文件
Sleep 2
click id=insert_select_format #点击下拉框按钮
Sleep 1
click ${type} #选择css
sleep 1
click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[5]/div/div/button[1] #点击OK
Sleep 1
input xpath=//*[@id="one-input"] ${name} #搜索输入框输入name
Sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[2]/div[2]/i #点击搜索按钮
Sleep 1
${text1} Get Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span #获取点击后页面文本信息
Should Be Equal As Strings ${text1} ${name} #断言
ui-logout
Create-Traffic Mirror Profiles
[Arguments] ${name} ${type} ${shuru}
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=profilesTabs_Profile_TrafficMirrorProfiles #点击Traffic Mirror Profiles按钮
Sleep 1
click id=trafficMirrorAdd #点击Create
Sleep 2
input id=trafficmirror_profileName ${name} #输入name
Sleep 2
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[2]/div/div/div[1]/span/span/i #点击下拉框
Sleep 2
click ${type} #选择vlan或者mac
Sleep 1
input id=trafficmirror_addrArray0 ${shuru}
sleep 2
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[5]/div/div/button[1] #点击OK
Sleep 2
input id=one-input ${name} #搜索输入框输入name
Sleep 1
click id=select_new_search_btn #点击搜索按钮
Sleep 1
${text1} Get Text xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr/td[2]/div/div/span #获取点击后页面文本信息
Should Be Equal As Strings ${text1} ${name} #断言
ui-logout
Edit-Insert Scripts
[Arguments] ${id-name} ${name} ${name1} ${file} ${type}
[Documentation] 引用关键字,填入必填参数
... 必填参数:
... ${id-name}:为选择要查询的类型是ID或者Name的元素
... ${name}:为查询输入框输入内容
... ${name1}:为修改页面的name输入框里输入的内容
... ${file}:为修改页面要上传文件的路径
... ${type}:选择文件类型的元素
Sleep 1
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=profilesTabs_Profile_Insert #点击Insert files按钮
sleep 1
click id=one-input #搜索点击输入框
sleep 1
click ${id-name} #选择ID或者name
sleep 1
input id=sreach_input ${name} #输入搜索内容
sleep 1
click xpath=//*[@id="select_new_search_btn"] #点击搜索按钮
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
sleep 1
click id=insertEdit #点击Edit
sleep 1
Clear Element Text id=insert_profileName #清空输入框
sleep 1
input id=insert_profileName ${name1} #输入框输入
sleep 1
Choose File xpath=//*[@id="insertAddUpload"]/div[1]/input ${file} #上传文件
sleep 1
click id=insert_select_format #点击下拉框
sleep 1
click ${type} #选择文件类型
sleep 1
click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[8]/div/div/button[1] #点击ok提交
Create-Response Pages
[Arguments] ${name} ${file}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${name}:新建页面name输入框里的内容
... ${file}:上传文件所在本地的路径
#打开浏览器
#ui-login lyf 111111
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=respinseAdd #Response Pages点击Create
Sleep 2
input id=responsepages_profileName ${name} #输入name
Sleep 2
Choose File xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[2]/div/div/div/input ${file} #上传文件
Sleep 2
click xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[4]/div/div/button[1] #点击OK缇交
Sleep 1
input xpath=//*[@id="one-input"] ${name} #搜索框输入
Sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[1]/div[2]/i #点击搜索按钮
Sleep 1
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/span #获取点击后页面文本信息
Should Be Equal As Strings ${text1} ${name} #断言
#ui-logout
Edit-Response Pages
[Arguments] ${id-name} ${name} ${name1} ${file}
[Documentation] 引用关键字,填入必填参数
... 必填参数:
... ${id-name}:为选择要查询的类型是ID或者Name的元素
... ${name}:为查询输入框输入内容
... ${name1}:为修改页面的name输入框里输入的内容
... ${file}:为修改页面要上传文件的路径
Sleep 1
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=one-input #搜索点击输入框
sleep 1
click ${id-name} #选择ID或者name
sleep 1
input id=sreach_input ${name}
sleep 1
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
sleep 1
click id=resinseEdit #点击Edit
sleep 1
Clear Element Text id=responsepages_profileName #清空name输入框
sleep 1
input id=responsepages_profileName ${name1}
sleep 1
Choose File xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[5]/div/div/div/input ${file}
sleep 1
click xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[7]/div/div/button[1]
Edit-Hijack Files
[Arguments] ${id-name} ${name} ${name1} ${file} ${type}
[Documentation] 引用关键字,填入必填参数
... 必填参数:
... ${id-name}:为选择要查询的类型是ID或者Name的元素
... ${name}:为查询输入框输入内容
... ${name1}:为修改页面的name输入框里输入的内容
... ${file}:为修改页面要上传文件的路径
... ${type}:为文件类型的元素
Sleep 1
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=profilesTabs_Profile_HijackFiles #点击Hijack files按钮
sleep 1
click id=one-input #搜索点击输入框
sleep 1
click ${id-name} #选择ID或者name
sleep 1
input id=sreach_input ${name} #输入搜索内容
sleep 1
click xpath=//*[@id="select_new_search_btn"] #点击搜索按钮
sleep 1
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
sleep 1
click id=hijackEdit #点击Edit
sleep 1
Clear Element Text id=hijack_profileName #清空输入框
sleep 1
input id=hijack_profileName ${name1} #输入框输入
sleep 1
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[1]/div[2]/form/div[5]/div/div/div[1]/input ${file} #上传文件
sleep 1
click id=hijackAddContentType #点击+号打开侧滑框
sleep 3
click ${type} #选择类型
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[2]/button #关闭侧滑框
sleep 1
click id=hijackAddOk #点击ok提交
Edit-Traffic Mirror Profiles
[Arguments] ${id-name} ${name} ${name1} ${type} ${shuju}
[Documentation] 引用关键字,填入必填参数
... 必填参数:
... ${id-name}:为选择要查询的类型是ID或者Name的元素
... ${name}:为查询输入框输入内容
... ${name1}:为修改页面的name输入框里输入的内容
... ${type}:为选择点击vlan或mac的元素
... ${shuju}:为输入框输入内容
Sleep 1
click xpath=//*[@id="app"]/div/div[2]/ul/li[6]/div #点击一级目录Settings
Sleep 1
click id=sidebarProxy_Profiles #点击二级目录Proxy Profiles
Sleep 2
click id=profilesTabs_Profile_TrafficMirrorProfiles #点击Traffic Mirror Profiles按钮
sleep 1
click id=one-input #搜索点击输入框
sleep 1
click ${id-name} #选择ID或者name
sleep 1
input id=sreach_input ${name} #输入搜索内容
sleep 1
click xpath=//*[@id="select_new_search_btn"] #点击搜索按钮
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div[2]/div/div[3]/table/tbody/tr[1] #点击搜素到的列表
sleep 1
click id=trafficMirrorEdit #点击Edit
sleep 1
Clear Element Text id=trafficmirror_profileName #清空输入框
sleep 1
input id=trafficmirror_profileName ${name1} #输入框输入
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[5]/div/div/div[1]/input #点击下拉框
sleep 1
click ${type} #选择vlan或者mac
sleep 1
Clear Element Text id=trafficmirror_addrArray0 #清空输入框
sleep 1
input id=trafficmirror_addrArray0 ${shuju} #输入内容
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[8]/div/div/button[1] #点击ok
import-Trusted Certificate Authorities
[Arguments] ${name} ${file}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${name}:新建页面name输入框里的内容
... ${file}:上传文件所在本地的路径
#打开浏览器
#ui-login lyf 111111
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
Sleep 2
click id=Authorities_create #点击Import
Sleep 2
input id=authoritiesAdd_name ${name} #输入name
Sleep 2
Choose File xpath=//*[@id="upload_dome"]/div/input ${file} #上传文件
Sleep 2
click id=authoritiesAdd_sub #点击OK缇交
Sleep 1
input xpath=//*[@id="one-input"] ${name} #搜索框输入
Sleep 1
click id=select_new_search_btn #点击搜索按钮
Sleep 1
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/div/p/span #获取点击后页面文本信息
Should Be Equal As Strings ${text1} ${name} #断言
#ui-logout
Create-Decryption Keyrings
[Arguments] ${name} ${file} ${file1} ${1or2} ${type} ${type1}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${name}:新建页面name输入框里的内容
... ${file}:上传文件所在本地的路径
... ${file1}:上传文件所在本地的路径
... ${1or2}:填入1 或者其他
... ${type}:上传证书类型的元素
... ${type1}:上传证书加密解密算法的元素
#打开浏览器
#ui-login lyf 111111
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
Sleep 2
click xpath=//*[@id="proxyTabs"]/div/ul/li[2] #点击Decryption Keyrings
sleep 1
click id=Keyrings_create #点击Create
Sleep 2
input id=keyringsadd_name ${name} #输入name
Sleep 2
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[2]/div/div/div/input ${file} #上传文件
Sleep 2
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[4]/div/div/div/input ${file1} #上传文件
${select} Set Variable ${1or2}
Run Keyword If '${select}'=='1' click id=keyringsadd_customized
Run Keyword If '${select}'=='1' input id=reissueExpiryDate 10
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[7]/div/div/div[1] #点击下拉框
sleep 1
click ${type} #选择证书类型
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[8]/div/div/div[1] #点击下拉框
sleep 1
click ${type1} #选择加密解密类型
sleep 1
click id=keyringsadd_sub #点击OK缇交
Sleep 1
input xpath=//*[@id="one-input"] ${name} #搜索框输入
Sleep 1
click id=select_new_search_btn #点击搜索按钮
Sleep 1
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/div/p/span #获取点击后页面文本信息
Should Be Equal As Strings ${text1} ${name} #断言
#ui-logout
Create-SSL Decryption Exclusion
[Arguments] ${name} ${value} ${name1}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${name}:新建页面name输入框里的内容
... ${value}:输入内容
... ${naem1}:搜索框填入内容
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
Sleep 2
click xpath=//*[@id="proxyTabs"]/div/ul/li[3] #点击SSL Decryption Exclusion按钮
sleep 1
click id=ssl_create #点击Create
Sleep 2
input id=sslAdd_name ${name} #输入name
Sleep 2
input id=sslAdd_itemDesc ${value} #输入内容
Sleep 2
click id=ssl_ok #点击OK缇交
Sleep 1
input xpath=//*[@id="one-input"] ${name1} #搜索框输入
Sleep 1
click id=select_new_search_btn #点击搜索按钮
Sleep 1
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/div/p/span #获取点击后页面文本信息
Should Be Equal As Strings ${text1} ${name} #断言
Search-Cached Intermediate Certificates
[Arguments] ${type} ${id-sni} ${enabled}
[Documentation] 引用关键字,填入必填参数
... ${type}:为搜索类型的元素id或sni
... ${enabled}为enabled开启或关闭按钮的元素
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
Sleep 2
click xpath=//*[@id="proxyTabs"]/div/ul/li[4] #点击Cached Intermediate Certificates按钮
Sleep 1
click id=one-input #点击搜索框
Sleep 1
click ${type}
Sleep 1
input id=sreach_input ${id-sni}
click id=select_new_search_btn #点击搜索按钮
Sleep 1
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[8]/div/div/div/p/a/i #点击下载
Sleep 10
click ${enabled} #点击enabled按钮
sleep 1
Edit-Trusted Certificate Authorities
[Arguments] ${id-name} ${value} ${name} ${file}
[Documentation] 引用关键字,填入必填参数
... 必填参数:
... ${id-name}:为选择要查询的类型是ID或者Name的元素
... ${value}:为查询输入框输入内容
... ${name}:为修改页面的name输入框里输入的内容
... ${file}:为修改页面要上传文件的路径
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
Sleep 2
click id=one-input #点击搜索框
sleep 1
click ${id-name} #选择搜索类型
sleep 1
input id=sreach_input ${value} #输入内容
sleep 1
click id=select_new_search_btn #点击搜索按钮
sleep 1
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr #点击搜索列表
sleep 1
click id=Authorities_edit #点击Edit按钮
sleep 1
Clear Element Text id=authoritiesAdd_name #清空name输入框
sleep 1
input id=authoritiesAdd_name ${name} #输入name
sleep 1
Choose File xpath=//*[@id="upload_dome"]/div/input ${file} #上传文件
sleep 1
click id=authoritiesAdd_sub #点击ok
Edit-Decryption Keyrings
[Arguments] ${id-name} ${value} ${name} ${file} ${file1} ${1or2}
... ${type} ${type1}
[Documentation] 引用次关键字,填入必填参数
... 必填参数:
... ${id-name}:为选择要查询的类型是ID或者Name的元素
... ${value}:为查询输入框输入内容
... ${name}:新建页面name输入框里的内容
... ${file}:上传文件所在本地的路径
... ${file1}:上传文件所在本地的路径
... ${1or2}:填入1 或者其他
... ${type}:上传证书类型的元素
... ${type1}:上传证书加密解密算法的元素
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
Sleep 2
click xpath=//*[@id="proxyTabs"]/div/ul/li[2] #点击Decryption Keyrings
sleep 1
click id=one-input #点击搜索框
sleep 1
click ${id-name} #选择搜索类型
sleep 1
input id=sreach_input ${value} #输入内容
sleep 1
click id=select_new_search_btn #点击搜索按钮
sleep 1
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr #点击搜索列表
sleep 1
click id=Keyrings_edit #点击Edit按钮
sleep 1
Clear Element Text id=keyringsadd_name #清空name输入框
sleep 1
input id=keyringsadd_name ${name} #输入name
sleep 1
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[5]/div/div/div/input ${file} #上传文件
Sleep 2
Choose File xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[7]/div/div/div/input ${file1} #上传文件
${select} Set Variable ${1or2}
Run Keyword If '${select}'=='1' click id=keyringsadd_customized
Run Keyword If '${select}'=='1' input id=reissueExpiryDate 10
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[10]/div/div/div[1] #点击下拉框
sleep 1
click ${type} #选择证书类型
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/div/div[2]/form/div[11]/div/div/div[1] #点击下拉框
sleep 1
click ${type1} #选择加密解密类型
sleep 1
click id=keyringsadd_sub #点击OK缇交
Edit-SSL Decryption Exclusion
[Arguments] ${id-name} ${value} ${name} ${value1}
[Documentation] 引用关键字,填入必填参数
... ${id-name}:id或者name的元素
... ${value}:输入搜索的内容
... ${name}:输入name
... ${calue1}:输入内容
Sleep 1
click id=children5 #点击一级目录Settings
Sleep 1
click id=sidebarProxy_CertificateManagement #点击二级目录Trusted Certificate Authorities
Sleep 2
click xpath=//*[@id="proxyTabs"]/div/ul/li[3] #点击SSL Decryption Exclusion按钮
sleep 1
click id=one-input #点击搜索框
sleep 1
click ${id-name} #选择搜索类型
sleep 1
input id=sreach_input ${value} #输入内容
sleep 1
click id=select_new_search_btn #点击搜索按钮
sleep 1
click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr #点击搜索列表
Sleep 1
click id=ssl_edit #点击Edit
Sleep 1
Clear Element Text id=sslAdd_name #清空name输入框
sleep 1
input id=sslAdd_name ${name} #输入name
sleep 1
input id=sslAdd_itemDesc ${value1} #输入内容
Sleep 2
click id=ssl_ok #点击OK缇交

View File

@@ -0,0 +1,120 @@
*** Settings ***
Library Selenium2Library
*** Keywords ***
ui-tags-create
[Arguments] ${tag-name} ${color-element} ${tag-value}
[Documentation] 引用关键字,填入必填参数:
... ${tag-name}:输入tag 的name
... ${color-element}:选择tag字体的颜色
... ${tag-value}:输入tag内容
click element id=tagAdd #点击create按钮新建tag
sleep 2
input text id=tagsAdd_name ${tag-name} #输入tag name
sleep 1
click element id=tagsAdd_color #点击color
sleep 2
click element ${color-element} #选择tag字体颜色
sleep 2
input text id=tag_tagName0 ${tag-value} #输入tag内容
sleep 1
click element id=tagAddOk1
sleep 1
ui-tags-create-1
[Arguments] ${tag-name} ${color-element} ${tag-value} ${tag-value1}
[Documentation] 引用关键字,填入必填参数:
... ${tag-name}:输入tag 的name
... ${color-element}:选择tag字体的颜色
... ${tag-value}:输入tag内容
... ${tag-value1}:输入tag内容
click element id=tagAdd #点击create按钮新建tag
sleep 2
input text id=tagsAdd_name ${tag-name} #输入tag name
sleep 1
click element id=tagsAdd_color #点击color
sleep 2
click element ${color-element} #选择tag字体颜色
sleep 1
input text id=tag_tagName0 ${tag-value} #输入tag内容
sleep 1
click element id=tagAddInput
input text id=tag_tagName1 ${tag-value1} #输入tag内容
sleep 1
click element id=tagAddOk1
ui-tags-edit
[Arguments] ${tag-name} ${color-element} ${tag-value}
[Documentation] 引用关键字,填入必填参数:
... ${tag-name}:输入tag 的name
... ${color-element}:选择tag字体的颜色
... ${tag-value}:输入tag内容
sleep 1
click element id=tagEdit #点击edit按钮
sleep 2
input text id=tagsAdd_name ${tag-name} #输入tag name
sleep 2
click element id=tagsAdd_color #点击color
sleep 1
click element ${color-element} #选择tag字体颜色
sleep 1
input text id=tag_tagName0 ${tag-value} #输入tag内容
sleep 1
click element id=tagAddOk1
sleep 1
ui-tags-search-id
[Arguments] ${id}
sleep 1
click element id=one-input
sleep 1
click element id=input_list_li1
sleep 1
input text id=sreach_input ${id}
sleep 1
click element id=select_new_search_btn
sleep 1
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
ui-tags-search-name
[Arguments] ${name}
sleep 1
click element id=one-input
sleep 1
click element id=input_list_li2
sleep 1
input text id=sreach_input ${name}
sleep 1
click element id=select_new_search_btn
sleep 1
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table
ui-tags-delete
sleep 1
click element id=tagDel #点击删除按钮
sleep 1
click element id=tags-tagsDel-confirm
ui-tags-edit-1
[Arguments] ${tag-name} ${color-element} ${tag-value} ${tag-value1}
[Documentation] 引用关键字,填入必填参数:
... ${tag-name}:输入tag 的name
... ${color-element}:选择tag字体的颜色
... ${tag-value}:输入tag内容
... ${tag-value1}:输入tag内容
sleep 1
click element id=tagEdit #点击edit按钮
sleep 2
input text id=tagsAdd_name ${tag-name} #输入tag name
sleep 1
click element id=tagsAdd_color #点击color
sleep 1
click element ${color-element} #选择tag字体颜色
sleep 2
input text id=tag_tagName0 ${tag-value} #输入tag内容
sleep 1
sleep 1
click element id=tagAddInput
input text id=tag_tagName1 ${tag-value1} #输入tag内容
click element id=tagAddOk1
sleep 1