Skip to content

Instantly share code, notes, and snippets.

@kyk4322
Last active January 30, 2019 22:55
Show Gist options
  • Save kyk4322/a2e31cbd8679f3378c8a662fb3e8a895 to your computer and use it in GitHub Desktop.
Save kyk4322/a2e31cbd8679f3378c8a662fb3e8a895 to your computer and use it in GitHub Desktop.
Selenium
DataTable dt = new DataTable();
var header = driver.FindElement(By.CssSelector("#gridComponent > div.k-grid-header"));
foreach (var row in header.FindElements(By.TagName("tr")))
{
//Configure Number of Col and row
int cellIndex = 0;
string[] arr = new string[32];
//Get Cell Data
foreach (var cell in row.FindElements(By.TagName("thead")))
{
//Number of Col Data Load
if (cellIndex <= 29)
{
arr[cellIndex] = cell.Text;
}
else
continue;
cellIndex++;
}
dt.Columns.Add(arr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment