我有一个问题"页应该包含元素"关键字与"Create webdriver"字。
例如使用"打开浏览器"关键字,我打开浏览器,搜索一个项目,然后说"页面应该包含元素"。在这种情况下,测试用例将等待x秒,并且只有当元素不在那里时才会失败。
但是,如果我使用"Create webdriver"关键字,页面应该包含元素"关键字willnot等待x秒,如果元素不在,则立即失败。
如果我的方法打开浏览器是问题,这是我怎么做的:
Open Chrome with extension
${ChromeOptions} = Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${ChromeOptions} add_extension ${EXECDIR}${/}ChroPath.crx
${Options}= Call Method ${ChromeOptions} to_capabilities
Create Webdriver Chrome desired_capabilities=${Options}
Go to ${ENV_URL}
我已经通过
检查了超时${implicit}= Get Selenium Implicit Wait
${speed}= Get Selenium Speed
${timeout}= Get Selenium Timeout
和返回的值是相同的,无论我是否打开浏览器或创建webdriver。
任何帮助将不胜感激!
使用以下关键字,它将等待最多30秒,每5秒验证文本是可见的。(秒是你的选择,所以你可以根据你的需要修改)
Wait Until Keyword Succeeds 30s 5s Page Should Contain ${text}
您可以在SeleniumLibrary中使用下面的关键字,它将等待给定的时间${timeout}或直到页面包含该元素。
Wait Until Page Contains Element ${locator} ${timeout}