In java, I use code like this to grab a list of WebElements with the same id:
@FindBy(how = How.CLASS_NAME, using = "name") private List<WebElement> names;
Now I am using C # and I am trying to do the same using:
[FindsBy(How = How.ClassName, Using = "name")] private List<IWebElement> names;
However, this gives an exception:
System.ArgumentException: an object of type 'Castle.Proxies.IWrapsElementProxy_1' cannot be converted to type 'System.Collections.Generic.List`1 [OpenQA.Selenium.IWebElement]'.
I tried FindAllBy and FindBys, however they do not seem valid. Anyway, I can do it except
names = getDriver().findElements(By.ClassNames("...")) ?
source share