I'm using PhantomJSDriver and trying to add some elements to an array with an intention to do something along the lines of
var myElements = driver.FindElements(By.Id("bla"));
myElements. ? ... (ElementAt() missing..)
How come ElementAt()does not show in the this case (The only reasonable available option that shows is IndexOf) ?
Are you sure ElementAt() is not deprecated?
FindElements(By) returns a ReadOnlyCollection of IWebElement
ReadOnlyCollection does not have ElementAt() as a method.
Source: http://msdn.microsoft.com/en-us/library/ms132474
If you just want to find and do something to one of the elements in that collection, you can always use a foreach loop. Pseudo-ish code below:
foreach (IWebElement element in myElements)
{
//If element matches the one I want
//then do something i.e. Click it
}
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.