Forum Discussion
ArtemS
Alumni
14 years agoHi Jack,
Here is an example of waiting for the web button using the WaitChild method:
Sub WaitBtn1
Dim iexplore
Dim searchform
TestedApps.Page.Run
Set iexplore = Sys.Process("IEXPLORE")
Call iexplore.ToUrl("http://w3schools.com")
Set searchform = iexplore.Page("http://w3schools.com/").Panel(0).Panel(0).Panel(0).Form("searchform")
' Wait for the Search button
If searchform.WaitChild("SubmitButton(""Search"")", 2000).Exists Then
' Child object exists
searchform.Textbox("as_q").Text = "MyText"
Call searchform.SubmitButton("Search").Click
Else
' There is no such child
Log.Warning("The Search button was not found.")
End If
End Sub
Another way to wait for the needed web element is to call the NativeWebObject.Find method untill the respective element becomes available:
Sub WaitBtn2
Dim iexplore
Dim searchBtn
TestedApps.Page.Run
Set iexplore = Sys.Process("IEXPLORE")
Set Pg = iexplore.ToUrl("http://w3schools.com")
' Wait for the Search button
Do
aqUtils.Delay 100
Set searchBtn = Pg.NativeWebObject.Find("title", "Search", "INPUT")
Loop Until searchBtn.Exists
Pg.Panel(0).Panel(0).Panel(0).Form("searchform").Textbox("as_q").Text = "MyText"
searchBtn.Click
End Sub
Regards.
* Run, live to fly, fly to live, Aces high