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”

有人能帮我吗?

Its
IList 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(""));