我刚刚开始使用Robot Framework,我编写了应该通过的简单测试,但他们没有。屏幕截图清楚地显示了元素在网站上。这些是几个例子:
Page Should Contain Element name websiteRegistration
或
Page Should Contain Sign in and start watching
寻找文字。
整个resource.txt如下所述:
*** Settings ***
Documentation A resource file with reusable keywords and variables.
...
... The system specific keywords created here form our own
... domain specific language. They utilize keywords provided
... by the imported Selenium2Library.
Library Selenium2Library
*** Variables ***
${SERVER} localhost:8080
${BROWSER} Firefox
${DELAY} 20
${HOME URL} http://${SERVER}/some-link-that-works
*** Keywords ***
Open Browser To Welcome Page
Open Browser ${HOME URL} ${BROWSER}
Check If It Works
Set Selenium Speed ${DELAY}
Page Should Contain Sign in and start watching
感谢您的帮助!!
答案 0 :(得分:1)
如果没有其他信息,我猜,您的测试代码到达页面的时间有点太早了。请尝试以下方法:
Check If It Works
Set Selenium Speed ${DELAY}
Wait Until Page Contains Sign in and start watching
Page Should Contain Sign in and start watching
查看this list了解详情。