swathi_reddy
swathi_reddy

Reputation: 265

pagefactory with explicit wait in c# for collection of webelements

Can anybody tell me how to use explicit wait using pagefactory for a collection of webelements ?

[FindsBy(How = How.ClassName, Using = "tree-item-content")]
public IList<IWebElement> TreeItems { get; set; }

Upvotes: 3

Views: 728

Answers (1)

swathi_reddy
swathi_reddy

Reputation: 265

This solves my issue let me know if this is not a good way to solve the problem

WebDriverWait wait = new WebDriverWait(Driver.WebDriver,TimeSpan.FromSeconds(20)); 
wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(new ReadOnlyCollection<IWebElement>(TreeItems)));

Upvotes: 3

Related Questions