*** Settings *** Library Selenium2Library Resource ../Menu.robot Library Collections Library ../../../04-CustomLibrary/Custometest/StringManipulation.py *** Keywords *** openbrower Open Browser http:192.168.40.120 chrome CreateButton Wait Until Element Is Enabled id=userAdd sleep 1 Click element id=userAdd Create-Name [Arguments] ${accName} sleep 2 input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[1]/div/div[1]/input ${accName} Create-Username [Arguments] ${accName} sleep 2 input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[2]/div/div[1]/input ${accName} Create-Password [Arguments] ${accPasswd} sleep 2 input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${accPasswd} Create-Enable [Arguments] ${accEnable} sleep 2 run keyword if "${accEnable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div ... AND sleep 1 ... ELSE log 不操作 Create-Ok sleep 1 click button xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] Create-Cancel click button id=userAdd_cancel SelectOne sleep 3 click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] Delete-Delete sleep 2 click button xpath=/html/body/div/div/div[3]/button[2] Delete-Cancel click button xpath=/html/body/div[2]/div/div[3]/button[1] User-Delete sleep 1 click element id=userDel #点击删除按钮 sleep 1 click element xpath=/html/body/div/div/div[3]/button[2] CreatePage [Arguments] ${name} ${username} ${accPasswd} ${Required_Password_Change} ${day} ${accEnable} ${role} Menu administration Accounts CreateButton Create-Name ${name} Create-Username ${username} Create-Password ${accPasswd} input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div/input ${accPasswd} sleep 1 Create-Enable ${accEnable} sleep 1 run keyword if "${Required_Password_Change}"=="open" Run Keywords click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[5]/div/div ... AND sleep 1 ... AND input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day} ... ELSE log 不开启密码过期验证 Click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[last()]/div/div/div/span/span/i sleep 1 click element //span[.="${role}"] Create-Ok sleep 1 UserEdit [Arguments] ${password} ${enable} Sleep 2 click element id=userEdit Sleep 1 Create-Password ${password} input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div/input ${password} Sleep 1 run keyword if "${enable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div ... AND sleep 1 ... ELSE log 不操作 Create-Ok sleep 2 UserSearchName [Arguments] ${name} ${type} sleep 2 Wait Until Page Contains Element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div/div[1]/input 20 click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div/div[1]/input sleep 2 run keyword if "${type}"=="Name" run keywords click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] ... AND sleep 1 run keyword if "${type}"=="UserName" run keywords click element xpath=/html/body/div/div[1]/div[1]/ul/li[2] ... AND sleep 1 sleep 2 input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${name} sleep 2 click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/i sleep 2 click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] sleep 2 login [Arguments] ${UserName} ${Password} Mouse Hover xpath=//*[@id="app"]/div/div[1]/div[2]/div/span/div/span sleep 1 click element xpath=//div[@class='SignOut'] sleep 2 input text xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input ${UserName} sleep 1 input text xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input ${Password} sleep 1 click element xpath=/html/body/div/div/div[2]/div/div[4]/button sleep 2 Ui-Pages [Arguments] ${accpages} click element xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/ul/li[1] sleep 2 click element xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/button[2]/i sleep 2 Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/span[2]/div/input sleep 2 input text xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/span[2]/div/input ${accpages} sleep 2 press keys xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/span[2]/div/input ENTER sleep 2 Ui-Button [Arguments] ${accEnable} Menu administartion Accounts sleep 2 click element id=userAdd sleep 2 run keyword if "${accEnable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div[2]/form/div[4]/div/div ... AND sleep 1 ... ELSE log success TurnPage [Arguments] ${NextPage} ${PreviousPage} ${JumpInput} ${pages} ${AssertXpath} [Documentation] ... ${NextPage} 下一页按钮定位 ... ${PreviousPage} 上一页按钮定位 ... ${JumpInput} 跳转页面输入框 ... ${pages} 跳转得页码 ${text1} get text xpath=${AssertXpath} Click element xpath=${NextPage} sleep 2 ${text2} get text xpath=${AssertXpath} Click element xpath=${PreviousPage} sleep 2 ${text3} get text xpath=${AssertXpath} Clear Element Text xpath=${JumpInput} sleep 2 input text xpath=${JumpInput} ${pages} sleep 2 press keys xpath=${JumpInput} ENTER sleep 2 ${text4} get text xpath=${AssertXpath} Click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[last()]/div/ul/li[last()] sleep 2 ${text5} get text xpath=${AssertXpath} Should Not Be Equal ${text1} ${text2} Should Not Be Equal ${text3} ${text2} Should Not Be Equal ${text3} ${text4} Should Not Be Equal ${text1} ${text5} PagingDisplay [Arguments] ${Number} Mouse Over xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[4]/span/div/i sleep 1 run keyword if "${Number}"=="30" run keywords sleep 1 ... AND Click element xpath=//*[@id="page-size"]/div/label[2] ... ELSE IF "${Number}"=="50" run keywords sleep 1 ... AND Click element xpath=//*[@id="page-size"]/div/label[3] ... ELSE IF "${Number}"=="100" run keywords sleep 1 ... AND Click element xpath=//*[@id="page-size"]/div/label[4] ... ELSE Clear Element Text xpath=/html/body/div[last()]/div[1]/div[2]/input ... AND Input Text xpath=/html/body/div[last()]/div[1]/div[2]/input ${Number} sleep 1 Click element xpath=/html/body/div[last()]/div[1]/div[2]/button sleep 2 ${text} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[4]/div/span[1] sleep 1 ${Quantity} StringSegmentation ${text} sleep 1 ${quyu} Evaluate ${Quantity}%${Number} ${qumo} Evaluate ${Quantity}/${Number} ${qumo} Evaluate int(${qumo}) ${b} Set Variable ${1} ${Page1} Evaluate ${qumo}+${b} ${Page} Set Variable if "${qumo}" != "0" ${Page1} ${qumo} sleep 1 ${text} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[4]/div/ul/li[last()] Should Be Equal As Strings ${text} ${Page} DeletePage [Arguments] ${name} sleep 1 DeleteButton 1 Delete-Delete Pages [Arguments] Menu administartion Accounts sleep 3