diff options
Diffstat (limited to '02-Keyword/tsg_ui')
| -rw-r--r-- | 02-Keyword/tsg_ui/FTPHandle.robot | 94 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Log/Log.robot | 259 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Login/Login.robot | 26 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Logout/Logout.robot | 17 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Menu.robot | 23 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Objects/ObjectPages.robot | 71 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Objects/Objects.robot | 256 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Schedules/Schedules.robot | 260 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/SecurityPolicy/InterceptSSLModule.robot | 122 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/SecurityPolicy/SecurityPolicy.robot | 259 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Setting/Settings.robot | 541 | ||||
| -rw-r--r-- | 02-Keyword/tsg_ui/Tag/Tags.robot | 120 |
12 files changed, 2048 insertions, 0 deletions
diff --git a/02-Keyword/tsg_ui/FTPHandle.robot b/02-Keyword/tsg_ui/FTPHandle.robot new file mode 100644 index 0000000..42cc2c4 --- /dev/null +++ b/02-Keyword/tsg_ui/FTPHandle.robot @@ -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 diff --git a/02-Keyword/tsg_ui/Log/Log.robot b/02-Keyword/tsg_ui/Log/Log.robot new file mode 100644 index 0000000..d4cdc4c --- /dev/null +++ b/02-Keyword/tsg_ui/Log/Log.robot @@ -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} diff --git a/02-Keyword/tsg_ui/Login/Login.robot b/02-Keyword/tsg_ui/Login/Login.robot new file mode 100644 index 0000000..e91f39f --- /dev/null +++ b/02-Keyword/tsg_ui/Login/Login.robot @@ -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} diff --git a/02-Keyword/tsg_ui/Logout/Logout.robot b/02-Keyword/tsg_ui/Logout/Logout.robot new file mode 100644 index 0000000..f4ea7f1 --- /dev/null +++ b/02-Keyword/tsg_ui/Logout/Logout.robot @@ -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 diff --git a/02-Keyword/tsg_ui/Menu.robot b/02-Keyword/tsg_ui/Menu.robot new file mode 100644 index 0000000..08e8a54 --- /dev/null +++ b/02-Keyword/tsg_ui/Menu.robot @@ -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 diff --git a/02-Keyword/tsg_ui/Objects/ObjectPages.robot b/02-Keyword/tsg_ui/Objects/ObjectPages.robot new file mode 100644 index 0000000..0a4fe69 --- /dev/null +++ b/02-Keyword/tsg_ui/Objects/ObjectPages.robot @@ -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 diff --git a/02-Keyword/tsg_ui/Objects/Objects.robot b/02-Keyword/tsg_ui/Objects/Objects.robot new file mode 100644 index 0000000..08ca49e --- /dev/null +++ b/02-Keyword/tsg_ui/Objects/Objects.robot @@ -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 diff --git a/02-Keyword/tsg_ui/Schedules/Schedules.robot b/02-Keyword/tsg_ui/Schedules/Schedules.robot new file mode 100644 index 0000000..8b90349 --- /dev/null +++ b/02-Keyword/tsg_ui/Schedules/Schedules.robot @@ -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 diff --git a/02-Keyword/tsg_ui/SecurityPolicy/InterceptSSLModule.robot b/02-Keyword/tsg_ui/SecurityPolicy/InterceptSSLModule.robot new file mode 100644 index 0000000..c604573 --- /dev/null +++ b/02-Keyword/tsg_ui/SecurityPolicy/InterceptSSLModule.robot @@ -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 diff --git a/02-Keyword/tsg_ui/SecurityPolicy/SecurityPolicy.robot b/02-Keyword/tsg_ui/SecurityPolicy/SecurityPolicy.robot new file mode 100644 index 0000000..fe6d05d --- /dev/null +++ b/02-Keyword/tsg_ui/SecurityPolicy/SecurityPolicy.robot @@ -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] diff --git a/02-Keyword/tsg_ui/Setting/Settings.robot b/02-Keyword/tsg_ui/Setting/Settings.robot new file mode 100644 index 0000000..7874d91 --- /dev/null +++ b/02-Keyword/tsg_ui/Setting/Settings.robot @@ -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缇交 diff --git a/02-Keyword/tsg_ui/Tag/Tags.robot b/02-Keyword/tsg_ui/Tag/Tags.robot new file mode 100644 index 0000000..5e04028 --- /dev/null +++ b/02-Keyword/tsg_ui/Tag/Tags.robot @@ -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 |
