Our application uses dynamic grids for data entry. So after a user inserts new data in one of these grids, a new row is inserted at the end of the grid immediately below the last bit of data that the user entered. Additional data would then be set into this new row at the end of the grid.
I am trying to simulate this data entry process programmaticly via a data driven test and I am able to set data successfully the first time through the iteration.
However, I am having trouble setting data on iterations 2+. The problem is that the code I am using to get the newest row for data entry seems to return a cached element. As a result, data entered for iterations 2+ is being set into the first row of the dynamic grid.
Here is an example of the code that I am using to set a value in one of these dynamic grids:
Code: Select all
public static XfcTests.XfcTestsRepository repo = XfcTests.XfcTestsRepository.Instance;
...
Element lastCondCodeCell = repo.NonCached.ConditionCodesPanel.FindSingle("./row[last()='True']/cell[last()='True']");
lastCondCodeCell.Focus();
Delay.Duration(250, false);
Keyboard.Press(lastCondCodeCell, code);
repo.EncounterInformation.AccountTextEdit.Focus();
Delay.Duration(250, false);
Also, I set focus on a non-dynamic control after the data entry as a way to trigger our application to then insert the new dynamic row onto the end of the grid, thereby priming it for additional data entry.
If I had to guess, I think that the result of the FindSingle call is being cached. So, I moved the parent container to an application level folder in the control repository and set "Use Cache" to false for this folder. This change had no impact on the behavior.
Please advise, thanks!