Using the page object model where can I place my declaration of WebDriverWait so that it can be resused in POM? The below code is in the page class and the webelements are displayed in each page's own object repository. Here is my sample code
public bool IsAt()
{
try
{
WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
wait.Until(Driver => ObjectRepository.EnterButton.Displayed);
}
catch (Exception)
{
}
return ObjectRepository.EnterButton.Displayed;
}
如果要重新使用WebDriverWait
对象,则可以将其放在POM级别的类中,也可以将驱动程序包装到一个DriverWrapper类中,该类维护其自己的WebDriverWait
实例,在必要时公开WebDriverWait
,但允许与WebDriver
同时实例化-特别是考虑到WebDriverWait
直接依赖于WebDriver
对象本身。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.