Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created November 29, 2015 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/0348bae820d3a50a1ea9 to your computer and use it in GitHub Desktop.
Save angelovstanton/0348bae820d3a50a1ea9 to your computer and use it in GitHub Desktop.
public class KendoGrid
{
private readonly string gridId;
private readonly IJavaScriptExecutor driver;
public KendoGrid(IWebDriver driver, IWebElement gridDiv)
{
this.gridId = gridDiv.GetAttribute("id");
this.driver = (IJavaScriptExecutor)driver;
}
public void NavigateToPage(int pageNumber)
{
string jsToBeExecuted = this.GetGridReference();
jsToBeExecuted = string.Concat(jsToBeExecuted, "grid.dataSource.page(", pageNumber, ");");
this.driver.ExecuteScript(jsToBeExecuted);
}
private string GetGridReference()
{
string initializeKendoGrid = string.Format("var grid = $('#{0}').data('kendoGrid');", this.gridId);
return initializeKendoGrid;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment