Ask a Question

Handling Wizard Navigation Links

New Contributor

Handling Wizard Navigation Links

I'm using vbscript to test a web based app written in dot net.  I am having troubles handling certain types of links in my product and need some help.

There are several areas in the product that use wizards to configure things.  The wizards have navigation links at the top and bottom of each page.  The links are a little bit different than the rest of the links in the product so I cannot use my standard library function for link-clicking based on the text in the link.  I attempted to write a new function to handle these "wizard links", but something seems to not be working properly.  According to the test logs, the link is being clicked on, but the wizard never advances properly.

This is the wizard link I am trying to click on:

Sys.Process("iexplore", 2).Page("http://localhost/CAS/enu/CallProcessing/SwitchWizard/Welcome.aspx?wizinit_=1&_state=Switches_1").Form("aspnetForm").Table("ctl00_Table1").Cell(0, 0).Panel("formcontentdiv").Table(0).Cell(0, 0).Table(0).Cell(0, 0).Table(0).Cell(0, 0).Table(0).Cell(0, 0).Link("ctl00_mainContent_VeraWizardContainer1_ctl00_wiznext")

Here is the code that is supposed to click the Next button:

    Call Library.ClickWizLink("Next")

And here is the ClickWizLink code:

Sub ClickWizLink(linkText)

  dim p1, page, obj, PropArray, ValuesArray


  'initialize the broswer, page, and current form for testing

  Set p1 = Sys.Process("iexplore")

  Set page = p1.Page("*")   


  ' Creates arrays of properties and values

  PropArray = CreateVariantArray(0, 1)

  ValuesArray = CreateVariantArray(0, 1)


  ' Specifies property names

  PropArray(0) = "ObjectType"

  PropArray(1) = "Title"


  ' Specifies the property values

  ValuesArray(0) = "Link"

  ValuesArray(1) = "*" & linkText & "*"




  'Try to find the wizard Link

  Set obj = page.Find(PropArray, ValuesArray, 20)               

  If Not obj.Exists Then

    Log.Error("Check for link " + linkText + " failed")

    Exit Sub

  End If


  'if the control is not viewable on the screen the script should scroll the page down

  If Not obj.VisibleOnScreen Then


  End If


  'click the link and log it


  Log.Message("Link " + linkText + " was clicked.")

End Sub 'ClickLink

Hi Megan,

When you call the Click method without specifying the click coordinates, TestComplete clicks on the center of the object to be clicked. However, in some cases (for example, if the link is stretched to several lines), the center of the object might not be the correct place to be clicked. Try specifying the click coordinates (e.g. (1,1)) explicitly and check whether this helps. Also, you can try using the Desktop.MouseDown and Desktop.MouseUp methods to click the needed location explicitly (see the "MouseDown Method (Desktop Objects)" and "MouseUp Method (Desktop Objects)" help topics for more information).

Best regards,

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Contributor

Hi Allen,

I noticed yesterday when using the object explorer that when I highlighted the link with the crosshairs it was much longer than the actual text of the link (by about three times), so I think that your suggestion will solve my problem.  I just have one question about the coordinates for the Click method so that I have a frame of reference.  Which corner of the object would the coords (0,0) refer to?



Hi Megan,

The coordinates are specified relative to the top left corner of the object.

Best regards,

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Showing results for 
Search instead for 
Did you mean: