我可以使用 C# 访问 HTML table 数据吗?
Can I access an HTML table data using c#?
我可以使用 C# 访问 HTML table 的数据吗?
我必须从 C# 中获取 <td>
的 innerText(我不能使用其他任何东西)。
有简单的方法吗?也许使用 Selenium or Coypu?
是的,使用硒
IList<IWebElement> TRCollection = driver.FindElement(By.Id("tableId")).FindElements(By.TagName("tr"));
IList<IWebElement> TDCollection;
foreach(IWebElement element in TRCollection )
{
//td list from each row
TDCollection = element.FindElements(By.TagName("td"));
string column1 = TDCollection[0].Text;
...
}
Html 当我需要来自网页的任何数据时,我会使用 Agility Pack。它很方便,因为您得到了一个类似于 XmlDocument 的树,使得 "walk the tree" 或执行任何类型的查询变得容易。
我可以使用 C# 访问 HTML table 的数据吗?
我必须从 C# 中获取 <td>
的 innerText(我不能使用其他任何东西)。
有简单的方法吗?也许使用 Selenium or Coypu?
是的,使用硒
IList<IWebElement> TRCollection = driver.FindElement(By.Id("tableId")).FindElements(By.TagName("tr"));
IList<IWebElement> TDCollection;
foreach(IWebElement element in TRCollection )
{
//td list from each row
TDCollection = element.FindElements(By.TagName("td"));
string column1 = TDCollection[0].Text;
...
}
Html 当我需要来自网页的任何数据时,我会使用 Agility Pack。它很方便,因为您得到了一个类似于 XmlDocument 的树,使得 "walk the tree" 或执行任何类型的查询变得容易。