How can SilkTest click on a HtmlPushButton within a dynamic popup window?
If the page is totally dynamic, recording declarations will not work. How can I check for instances of HtmlPushButton and if any exist click on them?
This simple script gets all the children and loops through each individual child and finds out what each class these objects are instances of. This example states that if any of these are of an HtmlPushButton class, to click on it.. There is no error checking in this example so if clicking the button results in displaying a new page an error will be raised.
[-] testcase childrenTest () appstate none [ ] [ ] [ ] BrowserPage.SetActive() [ ] list of window lwPopupDecs [ ] lwPopupDecs = BrowserPage.GetChildren () // retrieve all children of the popup window [ ] window wPopupDecsComponent [ ] DATACLASS Class [ ] [-] for each wPopupDecsComponent in lwPopupDecs // parse through list of children [ ] Class = (wPopupDecsComponent.GetClass ()) // take each and determine their class [-] if Class == HtmlPushButton // if it equals to a HtmlPushButton class [ ] wPopupDecsComponent.Click () // click on this