Robot Framework 更有效的方法 "Sleep"
Robot Framework More efficient way to "Sleep"
我正在使用机器人框架,
目前我有 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
当我的测试增加到更大的数量时,运行 需要很多时间,
什么是更有效的使用 Sleep 的方法,或者适用于大量测试的不同关键字。我的网络应用加载时间为 1-5 秒。
外显睡眠通常不是很好。相反,您应该使用 Wait Until Element Is Visible
和 Wait Until Element Is Not Visible
或 Wait Until Page Contains Element
和 Wait Until Page Does Not Contain Element
.
我正在使用机器人框架,
目前我有 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
当我的测试增加到更大的数量时,运行 需要很多时间,
什么是更有效的使用 Sleep 的方法,或者适用于大量测试的不同关键字。我的网络应用加载时间为 1-5 秒。
外显睡眠通常不是很好。相反,您应该使用 Wait Until Element Is Visible
和 Wait Until Element Is Not Visible
或 Wait Until Page Contains Element
和 Wait Until Page Does Not Contain Element
.