Reputation: 91
I want to list the elements from part of a webpage. I am using the following statement to get the elements.
List<IWebElement> allElements = driver.FindElements(By.XPath("some path"));
But I’m getting the following compile error. Cannot implicitly convert type 'System.Collections.ObjectModel.ReadOnlyCollection' to 'System.Collections.Generic.List'
Can someone help me out?
Upvotes: 1
Views: 1529
Reputation: 1205
use
ReadOnlyCollection<IWebElement> list = driver.FindElements(By.XPath(""));
More detaik: Click
or
IList<IWebElement> list = driver.FindElements(By.XPath(""));
Upvotes: 3
Reputation: 4683
Its IList<IWebElement> list = driver.FindElements(By.XPath(""));
Where IList is taken from System.Collections.Generic.IList<OpenQA.Selenium.IWebElement>
Upvotes: 2