Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to close new tab
#1
Not Solved
Hi,

I am facing a problem.

In my application,I have to click on a link that open a new tab. As soon as it open a new tab,I have to close this new tab only. But below code does not do this.

'********************************************
Code:
If Browser("CreationTime:=1").Exist(0) Then
  print "present"
Browser("CreationTime:=1").Close
'fncloseBrowser()
  else
  print "not present"

End If
'*******************************

It print "present' in print log but not close the new tab and show error on line "Browser("creationTime:=1").close ". Error is "Object not visible".
And when I click on 'Retry' button of this Run error dialog box and get focus on new tab (by click on new tab) then only it get closed. Unless I dont foucs,it is not get closed .
Please let me the solution for this problem.
Reply
#2
Not Solved
Hi ,
(browser("creationtime:="&m).highlight ) statement highlight the browser which is currently visible ,not new one opened in a new tab.

If I manually click/focus on new tab then only it get closed by qtp. So please let me know how to click on new tab if we dont know any webelements on new page.
Reply
#3
Not Solved
Hi,
I am still looking for the solution. Please run this code and you will find the same bug which I am facing.Please anybody help me out asap.

Code:
systemutil.Run "iexplore.exe","yahoo.com"
Browser("title:=.*").Sync
Browser("title:=Yahoo! India").OpenNewTab
Browser("title:=Yahoo! India").OpenNewTab
Browser("title:=Yahoo! India").OpenNewTab
Browser("title:=Yahoo! India").OpenNewTab

sTitle="Yahoo! India"
Set oDesc = Description.Create
oDesc( "micclass" ).Value = "Browser"
oDesc( "application version" ).Value = "internet explorer.*"

Set vIE= Desktop.ChildObjects(oDesc)
vIECount=vIE.count
z=vIECount
For m=1To vIECount
z=z-1
    If Browser("creationtime:="&z).Exist(1) Then
        newTitle=Browser("creationtime:="&z).GetROProperty("title")
        If Not (sTitle = newTitle) Then
            Browser("creationtime:="&z).highlight
            Browser("creationtime:="&z).Close
        End If
  
    End If


Next
Reply
#4
Not Solved
Hi,
Any reply on above problem. I need solution urgently. Please help me .

Thanks & Regards
Pradeep Singh
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Maximize and Close a Browser mv8167 4 16,728 03-26-2023, 03:55 PM
Last Post: Mike B
  Close popup ad windows dustwynn 1 3,023 10-25-2016, 05:57 PM
Last Post: Ankur
  [UFT] Close opened folder robertosalemi 1 3,389 02-10-2016, 07:06 PM
Last Post: robertosalemi
  Close browser code not working akilamurugesh 1 4,671 08-26-2014, 03:21 PM
Last Post: vinod123
  Close on Exit Issue in QTP 11.0 EGBELL 1 3,231 02-02-2014, 03:39 PM
Last Post: EGBELL

Forum Jump:


Users browsing this thread: 1 Guest(s)