Forum Discussion

jonjdavey's avatar
jonjdavey
Occasional Contributor
14 years ago

WaitChild does not appear to recognise when a Link object appears in a webpage

I cannot get WaitChild to work for a logout Link which only appears after user has logged in:

Set logoutLink = Sys.Process("iexplore").Page(uRL).Panel(0).Panel(0).Panel(1).WaitChild("Link(2)", 1000)



If I insert a sleep(100) before the line of code above it works, but that defeats the object of trying to use the WaitChild method

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The problem may not be in the wait child for the link, but in the panel that the link is a child of.  Something to look at is whether or not that panel exists prior to logging in. 
  • jonjdavey's avatar
    jonjdavey
    Occasional Contributor
    Thanks for your response.



    I did think of that, so tried running this code:

    Set
    logoutLink =
    Sys.Process("iexplore").Page(uRL).Panel(0).Panel(0).WaitChild("Panel(1)",
    1000)

    Set
    logoutLink =
    Sys.Process("iexplore").Page(uRL).Panel(0).Panel(0).Panel(1).WaitChild("Link(2)",
    1000)



    However the code only fails on the second line (the new Link(2) object), so that does not appear to be the problem



  • Hi Jonathan,





    Try using the 'WaitLink' method:

    Set logoutLink = Sys.Process("iexplore").Page(uRL).Panel(0).Panel(0).Panel(1).WaitLink(2, 10000)





    Please see the 'Additional Methods Used to Obtain Web Pages Elements' section of the Working With Web Page Elements help topic.
  • jonjdavey's avatar
    jonjdavey
    Occasional Contributor
    Hi David,



    Thanks for your response.



    I had previously tried the WaitLink method but did not realise that I could specify my link using an index. Using the link name does not work, but using an index, as you suggest, did work. So thanks very much for your help!