Selenium webdriver 将FindElement的输出转换为IWebElement列表时出错
我想列出网页部分的元素。我使用下面的语句来获取元素Selenium webdriver 将FindElement的输出转换为IWebElement列表时出错,selenium-webdriver,Selenium Webdriver,我想列出网页部分的元素。我使用下面的语句来获取元素 List<IWebElement> allElements = driver.FindElements(By.XPath("some path")); List-allegements=driver.FindElements(By.XPath(“某些路径”); 但是我得到了下面的编译错误。 无法将类型“System.Collections.ObjectModel.ReadOnlyCollection”隐式转换为“System.C
List<IWebElement> allElements = driver.FindElements(By.XPath("some path"));
List-allegements=driver.FindElements(By.XPath(“某些路径”);
但是我得到了下面的编译错误。
无法将类型“System.Collections.ObjectModel.ReadOnlyCollection”隐式转换为“System.Collections.Generic.List”
有人能帮我吗?ItsIList list=driver.FindElements(By.XPath(“”)代码>
其中IList取自System.Collections.Generic.IList
使用
ReadOnlyCollection<IWebElement> list = driver.FindElements(By.XPath(""));
ReadOnlyCollection list=driver.FindElements(By.XPath(“”);
更多详情:
或
IList list=driver.FindElements(By.XPath(“”);
IList<IWebElement> list = driver.FindElements(By.XPath(""));