Quantcast
Channel: Automation Beyond
Viewing all articles
Browse latest Browse all 156

How to find all links on a web page (TestComplete)

$
0
0

Description

  1. Get parent object reference. In the example given, it’s a browser process, but you can narrow it down to a page or a web container object (table,  div, etc.).
  2. Use FindAllChildren to retrieve array of links.
    - You can limit search depth according to your context.
    - You may want to do filtered search using additional properties: Visible, VisibleOnScreen, ContentText, etc.

Implementation

  Dim PropNames, PropValues, IEProcess
  Dim Links

  PropNames = Array("processname", "index")
  PropValues = Array("iexplore", 1)

  Set IEProcess = Sys.FindChild(PropNames, PropValues, 1, True)

  PropNames = Array("ObjectType")
  PropValues = Array("Link")
  Links = IEProcess.FindAllChildren(PropNames, PropValues, 100, True)

  PropNames = Array("ObjectType", "Visible")
  PropValues = Array("Link", True)
  Links = IEProcess.FindAllChildren(PropNames, PropValues, 100, True)

Viewing all articles
Browse latest Browse all 156

Trending Articles