Micro Focus QTP (UFT) Forums
Browser("BrowserName").Back gives General Run Error... - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Browser("BrowserName").Back gives General Run Error... (/Thread-Browser-BrowserName-Back-gives-General-Run-Error)

Pages: 1 2


Browser("BrowserName").Back gives General Run Error... - deminiek - 10-03-2009

According to the QTP Help text, there's a function called Browser("BrowserName").Back that's supposed to take you to the previous web page. When I try using it, though, I get a General Run Error message (which is not overly helpful). What I'm trying to do is this...

1. From the main page, click on a link to navigate to a sub-page.
2. Retrieve some information off of the sub-page.
3. Return to the main page, and click on another link to navigate to a second sub-page.
4. Retrieve some additional information off of the second sub-page.
5. Return to the main page and log out.

Clicking on "forward" links to the individual sub-pages from the main page is no problem. How do I back up to the main page, though, without starting from scratch and logging into it again? Unfortunately, there's no navigation link that will take me back there, other than the browser's Back button. I tried adding it into the repository, but it just comes back as a WinToolbar class called ToolbarWindow32.


RE: Browser("BrowserName").Back gives General Run Error... - Saket - 10-03-2009

you can use Browser().Navigate to Navigate again to your main page. keep your main url and use when you need to navigate to main page.
See if this thread helps you. QTP Navigation between multiple applications
Back should also been worked here.
can you paste your lines of code?


RE: Browser("BrowserName").Back gives General Run Error... - basanth27 - 10-04-2009

General Run Error's are a pain in the neck. You never know why they pop up but as they state general they dont come with a explanation. Well here is my question,

1. Which version of QTP & IE do you use ?

Secondly, if you are familiar with "On Error resume Next" you can use this to capture the error number and then lookup on google to find the reason.

For Eg :

Code:
' At the start of your code write this,

On Error Resume Next
  ' your code block here...
...
...
Browser("BrowserName").Back
msgbox Err.Number
If Err.Number <> 0 Then
  msgbox Err.Description
End If

Let me know if this helps you.


RE: Browser("BrowserName").Back gives General Run Error... - deminiek - 10-06-2009

Thanks Saket. I took your suggestion and tried to get the error message. It spit out Error #-2147467259, but the Err.Description was blank. Searching Google for -2147467259 didn't return anything.

We're using QTP 9.2 with IE 7. The code is pretty straight-forward. This is what it's actually doing...

Code:
' Identify the new User ID and Password.
Browser(strBrowserName).Page(strPageName).Link("Temporary UID").Click

Browser(strBrowserName).Page(strPageName).Sync

If InStr(Browser(strBrowserName).Page(strPageName).WebElement("UID Message").GetROProperty("innerhtml"), "Dear") > 0 Then
  strTotalUIDMessage = Cstr(Browser(strBrowserName).Page(strPageName).WebElement("UID Message").GetROProperty("innerhtml"))
End If

intStartChar = InStr(1, strTotalUIDMessage, "User ID:", 1)
intEndChar = 50

strUIDReceived =  Cstr(Mid(strTotalUIDMessage, intStartChar, intEndChar))

intStartChar = 1
intEndChar = InStr(1, strUIDReceived, "<BR>", 1) - 2

strUIDPassword = Left(strUIDReceived, intEndChar)
        
intStartChar = InStr(1, strUIDReceived, "- Password", 1) + 2
intEndChar = Len(strUIDReceived) - intStartChar - 4

strUIDReceived = strUIDPassword & "   " & Cstr(Mid(strUIDReceived, intStartChar, intEndChar))

' Load the results into the Global DataSheet.
DataTable.Value("EMailTempUID", dtGlobalSheet) = strUIDReceived

On Error Resume Next
Browser(strBrowserName).Back

MsgBox Err.Number
If Err.Number <> 0 Then
  MsgBox Err.Description
End If



RE: Browser("BrowserName").Back gives General Run Error... - Saket - 10-06-2009

the error number -2147467259 usually appears when there is no more pages to go back at the browser.
Check the back button at your browser it must be disabled that means there is no any pages has been opened earlier.
open any url first and then open your url in the same browser and now try with code, it must be working.

if back does not work in this case, preferably use Browser.Navaigate


RE: Browser("BrowserName").Back gives General Run Error... - basanth27 - 10-06-2009

'deminiek' -
There are some Known Browser issues between QTP 9.2 and IE7, For eg : Right click context menu wouldnt work on IE7, .Sync generates error sometimes and doesnt.

I suggest you contact HP support and find out if they have a patch or the reason for the error because Browser().back is a documented feature which at any cost with the defined functionality should work and no alternative/workaround is required.


RE: Browser("BrowserName").Back gives General Run Error... - Saket - 10-06-2009

may be I am wrong Basanth, but I doubt on your point, lets see first how it works with OP.


RE: Browser("BrowserName").Back gives General Run Error... - basanth27 - 10-06-2009

What is OP Saket ?


RE: Browser("BrowserName").Back gives General Run Error... - Saket - 10-06-2009

I mean Original Poster Smile


RE: Browser("BrowserName").Back gives General Run Error... - basanth27 - 10-06-2009

Aaaah...Intresting Wink