SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to close particular tab - interview question

    I have opened only one browser which has 5 tabs each tab is opened with different web sites.

    1.google
    2.yahoo
    3.gmail
    4.google translator
    5.wikepedia

    How to close 4th one google translator tab alone and browser should not close <font color="yellow"> </font> <font color="white"> </font>

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: How to close particular tab - interview question

    Did you look in QTP help file if there is any function like CloseTab or something?

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to close particular tab - interview question

    I was able to find work arround for close all tabs method , but i did not get close particluar tab
    ex:
    JavaWindow("Eclipse").JavaTab("CTabFolder").CloseT ab Val

    but browser("Google"). close particular tab related methods are not available

  4. #4
    Advanced Member
    Join Date
    Nov 2007
    Location
    India
    Posts
    686
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to close particular tab - interview question

    From QTP Help file:-

    CloseAllTabs Method

    Note: Use the Close method to close only the tab (and the browser if the browser contains one or no tabs).

    So you need to use Browser("title:=Google.*").Close

    This works. Just you need to provide title of the browser tab.
    Kind regards,
    Anand Tambey

    RSS Feed : Break To Make it Better
    A Lazy person could be the best automation professional, if he is not lazy in implementing his ideas to reduce his work. ~Anand Tambey

  5. #5
    Junior Member
    Join Date
    Jun 2010
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to close particular tab - interview question

    Hey I think you should user 2 descriptive object for this,

    first is for identifying for the TABs and
    second is for the closing of the particular tab no.
    then you can close the specific tab.

  6. #6
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: How to close particular tab - interview question

    Well if you look in the QTP help file, The close method documents

    "Closes the browser window (or tab) that this test object represents."

    So just using the close method should work

  7. #7
    Member
    Join Date
    Sep 2010
    Location
    TN, India
    Posts
    377
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to close particular tab - interview question

    Hey guys,

    I think this way we can close whatever instance of browser pages are open..

    Dim pages, des
    set des = Description.Create
    des("micClass")="Browser"
    Set Pages = des.GetChildObjects
    For i=1 to Pages.Count
    Pages.Close
    Next

    If you want to close particluar page, then use

    For i=1 to Pages.Count
    if Pages.getROProperty("title") = "google translator" then
    Pages.Close
    Next

    Hope this will help you... If anything wrong, never wait to correct me...

    thx,
    Shanmugavel <font color="blue"> </font>
    Thank/Like to help others if my input helped you !!!
    I am speaking for myself, not for my employer nor any one.
    Automation Ecstasy

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:10 PM.

Copyright BetaSoft Inc.