Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Browser("BrowserName").Back gives General Run Error...
#1
Not Solved
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.
Reply
#2
Not Solved
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?

Reply
#3
Not Solved
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.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Not Solved
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
Reply
#5
Not Solved
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

Reply
#6
Not Solved
'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.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#7
Not Solved
may be I am wrong Basanth, but I doubt on your point, lets see first how it works with OP.

Reply
#8
Not Solved
What is OP Saket ?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#9
Not Solved
I mean Original Poster Smile

Reply
#10
Not Solved
Aaaah...Intresting Wink
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  General run error when Exist fails msacks 1 1,649 02-08-2019, 02:12 AM
Last Post: Ankur
  General Object Error(Find Object Error) akhandesh 1 3,410 02-24-2016, 01:05 PM
Last Post: sindhus
Rolleyes The test run cannot continue due to an unrecoverable error neerndg123 3 8,417 09-17-2015, 08:27 PM
Last Post: ananthakumarbe
  HI, i'm having a run time error ,please help? Awzar 0 2,394 01-24-2015, 06:52 AM
Last Post: Awzar
  Cannot find the "[ WebEdit ]" object's parent "[ Browser ]" (class Browser). Verify t Divya Roopa 1 8,283 03-11-2014, 12:13 PM
Last Post: devarapallliramana

Forum Jump:


Users browsing this thread: 1 Guest(s)