Forum Discussion

whuang's avatar
whuang
Regular Contributor
5 years ago
Solved

Why TC keeps waiting until the time expire while I can see the object I am waiting for is there

Hi Guys,   I was trying to get TC to click on a link and then click on another link on the page after. So I used a WaitChild method in the script, but it keeps waiting on the page until the 30 se...
  • AlexKaras's avatar
    AlexKaras
    5 years ago

    Hi,

     

    Possible code (assuming that the initial page is already opened in the browser):

    Dim page
    Dim oControl
    
    Set page = sys.Browser("*").Page("*<yourCompany>.com*")
    Set oControl = page.Find("contentText", "Photo, Video & Design", 30)
    If (oControl.Exists) Then
      Call oControl.Click()
    Else
      Call Log.Warning("Web element with the 'Photo, Video & Design' text was not found", , , , page.PagePicture)
    End If
    Call page.Wait() ' waits until new page is loaded
    
    Set oControl = page.Find("contentText", "Corel", 30)
    If (oControl.Exists) Then
      Call oControl.Click()
    Else
      Call Log.Warning("Web element with the 'Corel' text was not found", , , , page.PagePicture)
    End If
    Call page.Wait()