I have created a generic method which can be used to search for records in our AUT.
Now I have a scenario that I need to run my code multiple times. So I have created a loop and tried to execute. The first iteration it runs without any issues and page gets closed. Re-opened the page and all the controls get loaded, but object identification failed during the second iteration.
initializing the HtmlEdit object as below:
HtmlEdit medit = new HtmlEdit(objSearchPage);
medit.SearchProperties.Add("Name", "1$SearchText", PropertyExpressionOperator.Contains);
medit.SearchProperties[HtmlEdit.PropertyNames.TagName] = "INPUT";
medit.SearchProperties[HtmlEdit.PropertyNames.ControlType] = "Edit";
The playback failed while trying to enter text on 'medit' box during the second iteration. First iteration it succeeded: medit.Text = searchItem;