基础语法实际记录例子 存在问题:网页多个frame嵌套下难以查找到元素; 键盘操作不灵敏; *** Settings *** Library C:\Users\Administrator\.PyCharm2018.3\system\python_stubs\266080405\win32api.py Library SeleniumLibrary *** Variables *** ${server} https://dhj.yingyuntech.com/UCenter-webapp/orderPlusLogin/init.htm?rqurl=/UCenter-webapp/orderPlusIndex/init.htm%3Foverdue=0 ${browser} Chrome ${username} 18200000001 ${truePassWord} 123456 ${errorPassWord} 654321 *** Test Cases *** Login DHJ open browser ${server} ${browser} input text id=username ${username} input password id=userpassword ${truepassword} click link xpath=//*[@id="loginbutton"] location should be https://dhj.yingyuntech.com/UCenter-webapp/orderPlusLogin/init.htm?rqurl=/UCenter-webapp/orderPlusIndex/init.htm%3Foverdue=0 log login sueecc Newbie guide sleep 2 click link xpath=//*[@id="noviceBoot1"] click link xpath=//*[@id="noviceBoot2"] click link xpath=//*[@id="noviceBoot3"] click link xpath=//*[@id="noviceBoot4"] # frame should contain xpath=//*[@id="newFunctionTip"]/div[3]/a log close NG SU New feature alerts sleep 1 click link xpath=//*[@id="newFunctionTip"]/div[3]/a # element should be visible text=销售 wait until page contains Element xpath=//*[@id="wrapper"]/div[1]/div[2]/a 5 未找到元素 log close NFA SU sale sleep 1 mouse down xpath=//*[@id="firstmenu"]/li[1] # mouse down on image # click link xpath=//*[@id="firstmenu"]/li[1] sleep 1 click link xpath=//*[@id="menuadd_100101"] maximize browser window zhidaole sleep 2 select frame name=Sale-Add_iframe sleep 1 click element xpath=//*[@id="btnHardwareInfo"]/div/h1/a # click element xpath=//*[@id="crinputmore"] Select Customers # select frame name=Sale-Add_iframe # sleep 2 # click element xpath=//*[@id="crinputmore"] sleep 2 input text xpath=//*[@id="txbCr"] 001 press key xpath=//*[@id="tabdetail"]/tbody/tr[2]/td[2]/div/div/input 0206 click element xpath=//*[@id="buttomtable"]/tbody/tr[3]/td[2]/div # click element xpath=//*[@id="autoComplete_Group_0.7353889508205909"]/table/tbody/tr[1] # click button xpath=//*[@id="0"] #choose products # mouse over xpath=//*[@id="tabdetail"]/tbody/tr[2]/td[2]/div/div/input # click button xpath=//*[@id="tabdetail"]/tbody/tr[2]/td[2]/div/a # switch to context id=iframe # select frame xpath=//*[@id="iframe"] # switch to id=iframe # sleep 2 # select frame name=Sale-Add_iframe # click element xpath=//*[@id="linkchooseproduct"] # sleep 1 # select checkbox xpath=//*[@id="fcheckbox1"] # click button xpath=//*[@id="listButtonDiv"]/a[3]
记录UI自动化Demo
最新推荐文章于 2024-07-06 11:51:20 发布