I am working on a project that is requiring lots of coded steps for various reason. The coded steps are failing intermittently because they are processing too quickly. I have added numerous wait.forexists() and wait.fornomotion() throughout, but they don't seem to do what I need. If I add sleeps throughout, it works, but this is a bad solution.
The specific scenario I'm having trouble with is after logging in, a grid is created with dynamic header values. I'm selecting a value from the grid based on a value in one of the dynamic columns. First step is to find location of the proper column by searching through all headercells to find the matching column index. The issue I'm running into is the following lines of code executing before the radgridview is fully loaded resulting in a zero column count being returned:
public int globalTimeout = 10000;
public void login()
{
Pages.TestPage.SilverlightApp.LoginButton.User.Click();
Pages.TestPage.SilverlightApp.LoginPage.Wait.ForExistsNot(globalTimeout);
Pages.TestPage.SilverlightApp.HomePage.Wait.ForExists(globalTimeout);
Pages.TestPage.SilverlightApp.HomePage.Wait.ForNoMotion(globalTimeout);
}
public int findColumn(string value)
{
RadGridView grid = new RadGridView();
//if I add a System.Threading.Thread.Sleep(10000) before this grid is initialized, it works every time, if I don't, I randomly get a zero count of headerCells even though they exist
grid = Pages.TestPage.SilverLightApp.Test_RadGridView;
//If I add a grid.Wait.ForExists(10000) here, it still moves to the next line almost instantly as the grid exists but the data doesn't necessarily exist yet
//If I add a grid.Wait.ForNoMotion(10000) here, it still doesn't seem to matter
int cols = grid.HeaderRow.HeaderCells.Count;
Assert.IsTrue(cols != 0, "No header columns were found.");
//code code code
return columnNumber;
}
Any suggestions on how to better handle (through code!) the wait for radgridview to populate/ready for indexing?
The specific scenario I'm having trouble with is after logging in, a grid is created with dynamic header values. I'm selecting a value from the grid based on a value in one of the dynamic columns. First step is to find location of the proper column by searching through all headercells to find the matching column index. The issue I'm running into is the following lines of code executing before the radgridview is fully loaded resulting in a zero column count being returned:
public int globalTimeout = 10000;
public void login()
{
Pages.TestPage.SilverlightApp.LoginButton.User.Click();
Pages.TestPage.SilverlightApp.LoginPage.Wait.ForExistsNot(globalTimeout);
Pages.TestPage.SilverlightApp.HomePage.Wait.ForExists(globalTimeout);
Pages.TestPage.SilverlightApp.HomePage.Wait.ForNoMotion(globalTimeout);
}
public int findColumn(string value)
{
RadGridView grid = new RadGridView();
//if I add a System.Threading.Thread.Sleep(10000) before this grid is initialized, it works every time, if I don't, I randomly get a zero count of headerCells even though they exist
grid = Pages.TestPage.SilverLightApp.Test_RadGridView;
//If I add a grid.Wait.ForExists(10000) here, it still moves to the next line almost instantly as the grid exists but the data doesn't necessarily exist yet
//If I add a grid.Wait.ForNoMotion(10000) here, it still doesn't seem to matter
int cols = grid.HeaderRow.HeaderCells.Count;
Assert.IsTrue(cols != 0, "No header columns were found.");
//code code code
return columnNumber;
}
Any suggestions on how to better handle (through code!) the wait for radgridview to populate/ready for indexing?