dbaechtel
11 years agoContributor
How to use the Browser Back button when the Page URL is not static?
I am navigating through a list of Links that are children of a page. I am trying to Click each Link in turn and then use the Browser back button to return.
I am getting an unspecified VB runtime error (nice!).
What is wrong with the attached syntax? What is the correct vbscript to use the Back button?
See attached source file. My Syntax:
For iChild = 1 To Aliases.browser.pageSafetydirectSitemap.formAspnetform.panelMastercontent.ChildCount Step 1
'Posts an information message to the test log. Call Log.Message(iChild, "iChild =")
Set theObj = Aliases.browser.pageSafetydirectSitemap.formAspnetform.panelMastercontent.Child(iChild-1)
If (theObj.ObjectType = "Link") Then
If (Instr(theObj.Name,"PlaceHolder") = 0 _
And Instr(theObj.contentText,"Logout") = 0 _
And Instr(theObj.contentText,"Video") = 0 _
) Then
Call Log.Message(iChild, "Link =")
Call Log.Message(theObj.contentText, "content =")
Call theObj.Click()
' Obtains the browser process
Set browser = Sys.Browser("iexplore")
' Obtains the page currently opened in Internet Explorer
Set page = browser.Page("*")
Call page.Wait
Set browser = Sys.Browser("iexplore")
Set page = browser.Page("*")
Call page.Goback
End If
End If
Next
I am getting an unspecified VB runtime error (nice!).
What is wrong with the attached syntax? What is the correct vbscript to use the Back button?
See attached source file. My Syntax:
For iChild = 1 To Aliases.browser.pageSafetydirectSitemap.formAspnetform.panelMastercontent.ChildCount Step 1
'Posts an information message to the test log. Call Log.Message(iChild, "iChild =")
Set theObj = Aliases.browser.pageSafetydirectSitemap.formAspnetform.panelMastercontent.Child(iChild-1)
If (theObj.ObjectType = "Link") Then
If (Instr(theObj.Name,"PlaceHolder") = 0 _
And Instr(theObj.contentText,"Logout") = 0 _
And Instr(theObj.contentText,"Video") = 0 _
) Then
Call Log.Message(iChild, "Link =")
Call Log.Message(theObj.contentText, "content =")
Call theObj.Click()
' Obtains the browser process
Set browser = Sys.Browser("iexplore")
' Obtains the page currently opened in Internet Explorer
Set page = browser.Page("*")
Call page.Wait
Set browser = Sys.Browser("iexplore")
Set page = browser.Page("*")
Call page.Goback
End If
End If
Next