我使用的是Robot Framework,
目前我有5-10个测试用例,我使用睡眠来等待页面在点击按钮后完全加载。
*** Variables ***
${Name} = example name
${Next_Button} = xpath=//*[@id="app"]/div/div[1]/div[3]/div/div/div[1]/div[2]/div/div/div/button[2]
*** Keywords ***
Open Tab
Click Element xpath=//*[@id="app"]/div/div[1]/div[1]/div[2]/nav/ul/li[2]/a
Sleep 5s
Open Details
Click Element xpath=//*[@id="app"]/div/div[1]/div[3]/div/div/div[1]/div[2]/div/div[1]/img
sleep 5s
Navigate to Room Details
click button xpath=//*[@id="app"]/div/div[1]/div[3]/div/div/div[1]/div[2]/div/div/button
click button ${Next_Button}
click button ${Next_Button}
sleep 3s当我的测试增加到更大的数量时,运行它们将需要很长时间,
有什么更有效的方式来使用睡眠,或者使用一个不同的关键字来进行很多测试。我的web应用程序加载时间为1-5秒。
发布于 2018-08-10 16:25:06
显性睡眠通常不是很好。相反,您应该使用Wait Until Element Is Visible和Wait Until Element Is Not Visible或Wait Until Page Contains Element和Wait Until Page Does Not Contain Element。
https://stackoverflow.com/questions/51782046
复制相似问题