Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created March 13, 2015 16:15
Show Gist options
  • Save johnmmoss/c11bfe2abf078fc88c7a to your computer and use it in GitHub Desktop.
Save johnmmoss/c11bfe2abf078fc88c7a to your computer and use it in GitHub Desktop.
Selenium API get the Rows of an HTML table
var trElements = webDriver.FindElements(By.ClassName("tr-content"));
var result = new List<List<string>>();
foreach (var trElement in trElements)
{
var row = new List<string>();
foreach (var tdElement in trElement.FindElements(By.ClassName("td-content")))
{
row.Add(tdElement.Text);
}
result.Add(row);
}
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment