2

When I use PageObject and I want to set a time to wait for elements on the page then I use ImplicitlyWait:

Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));

This means that when my page object is initializing:

PageFactory.InitElements(Driver, this);

Then it will wait for elements not less then 3 seconds.

Also there is another feature of Selenium that I discovered recently: RetryingElementLocator class

Code of this class: https://seleniumhq.github.io/selenium/docs/api/dotnet/html/T_OpenQA_Selenium_Support_PageObjects_RetryingElementLocator.htm

As I understand it allows to set time to wait elements on a page for PageObject.

The example of usage is the next:

IWebDriver driver = new ChromeDriver();
RetryingElementLocator retry = new RetryingElementLocator(driver, TimeSpan.FromSeconds(5));
IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator();
PageFactory.InitElements(retry.SearchContext, this, decor);

So the question is: if there is any difference between 2 methods and if so when it's better to use the second one?

Denis Koreyba
  • 3,144
  • 1
  • 31
  • 49
  • no i guess both is different one is implicit wait applicable to all but RetryingElementLocator is Explicit wait applicable for a specific webelement – Rajnish Kumar Apr 26 '16 at 14:17
  • But it applies to all elements in a PageObject. But if you are right then the question is what is the difference between WebDriverWait Untill method and RetryingElementLocator? – Denis Koreyba Apr 26 '16 at 14:31
  • yes RetryingElementLocator acts as a webdriverwait (java) and Until works with expected conditions – Rajnish Kumar Apr 26 '16 at 14:35

0 Answers0