mhartman_1
15 years agoNew 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 & "*"
page.Refresh
'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
obj.ScrollIntoView(false)
End If
'click the link and log it
obj.Click
Log.Message("Link " + linkText + " was clicked.")
End Sub 'ClickLink
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 & "*"
page.Refresh
'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
obj.ScrollIntoView(false)
End If
'click the link and log it
obj.Click
Log.Message("Link " + linkText + " was clicked.")
End Sub 'ClickLink