Answer the question
In order to leave comments, you need to log in
How to update tab data?
Good afternoon.
I am automating ui application testing.
We have a WPF application. Testing with CodedUITest , searching for elements with FindByName.
After the introduction of Docking, we had tabs, but there was a problem with updating the information in the tab.
For example:
We open an area with a certain set of controls (opens in the master tab), work with these controls. Then we open an area with a different set of controls (the area opens in the same tab, that is, the master tab is redrawn). And the code does not show that the elements in the tab have changed.
Previously, this was solved with the help of constant re-opening of tabs, but it worked clumsily.
Recently, developers have introduced template substitution to speed up the work of grids. And now there is such a problem:
let's say there is a drop-down list (popup) and a button in the tab. At first we work with popup, we select value, and further we press the button. But when I try to click the button, an ElementNotAvailableException is thrown.
If you first press the button, then everything works. The developers say that this is just related to the replacement of templates, and we need to learn how to update the data in the tab in order to catch the new state.
It is interesting that the tests do not always fall.
Actually the question is:
I looked through many forums, but did not find how to update the information in the tab. The developers say that this should be implemented in tests. For example, I post part of the code. Selecting an item in the dropdown list and clicking on the button.
internal void Choose(AutomationElement element, string value)
{
if (NameProperty(element) != value)
{
Open(element);
AutomationElement valueInPopup = FindByName(PART_ListBox(), value);
ChooseValueInPopup(valueInPopup, value);
}
}
private void ChooseValueInPopup(AutomationElement element, string value)
{
AutomationElement valueInPopup = FindByName(element, value);
LeftClickElement(valueInPopup);
Thread.Sleep(1000);
}
private void ClickSaveEventButton()
{
AutomationElement saveButton = FooterSaveButton();
LeftClickElement(saveButton);
WaitBusyElementWithoutParameter(saveButton, BusyIndicator);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question