SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 3 123 LastLast
Results 1 to 10 of 28
  1. #1
    Apprentice
    Join Date
    May 2004
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Close Browser at the end of the Test

    Hi,

    how can i close the browser shurely after my test ended?
    At the End of the script i've got a Browser("IE").close statement. I also created a recovery scenario to close the browser, but sometimes i'm running into timeout's etc.
    Is there a way to close every browser instance, even if there are some Dialogs ontop like "Accept this cookie ...", when the test ends?

    Thanx

  2. #2
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    Nuke the process:

    On Error Resume Next
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    '============ Kill ALL Running IE Processes ========
    Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'IExplore.exe'")
    For Each objProcess in colProcessList
    objProcess.Terminate()
    Next


    Mark Smith.

  3. #3
    Apprentice
    Join Date
    May 2004
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    Hi mwsrosso,

    your code does not solve all of my problems. See following code snipped:
    <font class="small">Code:</font><hr /><pre>On Error Resume Next
    Err.Raise 6 ' Raise an overflow error.
    MsgBox "Error # " &amp; CStr(Err.Number) &amp; " " &amp; Err.Description
    Err.Clear ' Clear the error.

    ExitTestIteration

    SystemUtil.CloseProcessByName "IEXPLORE.EXE"</pre><hr />
    in this case the browser is still open, but i need a way to close it surely after the testrun ends, wheater the test ended "normaly", with an Error, by "ExitTestIteration", or every possible way a qtp test can end.
    Im looking for something like a "post run action" or a "clean up task".

  4. #4
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    If you wish to close all the browsers, you could use SystemUtil.CloseProcessByName "...exe" to close the browser process. I am not sure, if this answers your question.
    Thanks,
    Ganesh Iyer
    Winds of Change

  5. #5
    Apprentice
    Join Date
    May 2004
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    Hi,

    no, this is not the answer i'm looking for.
    I know how to close the browser, but i don't know how/where i have to invoke this command, or how to configure qtp. By the way, i prefer:
    SystemUtil.CloseDescendentProcesses

    because if i use
    SystemUtil.CloseProcessByName "IEXPLORE.EXE"

    my QC browser instance will be closed to.

  6. #6
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    What is your requirement, u have a number of iterations for a test.
    Do u have a number of tests that have to be run in a sequence?..

    Can u provide me this information.

    Agreed, if you have QC running then use the SystemUtil.CloseDescendentProcesses
    Thanks,
    Ganesh Iyer
    Winds of Change

  7. #7
    Apprentice
    Join Date
    May 2004
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    [ QUOTE ]
    What is your requirement

    [/ QUOTE ]
    I must! close all browsers, expect the one where i'm connected with QC, before a test can start.

    [ QUOTE ]
    u have a number of iterations for a test.
    Do u have a number of tests that have to be run in a sequence?..

    [/ QUOTE ]
    I have lots of tests which should run over night. Some of them are depending on other tests, but thats not the problem.
    The problem is that i must start with a "clean environment" (no open browsers exept th QC one) because of the application i'm testing.
    Thats the reason why i'm looking for a way to to the cleanup in every! case a test is finished.

  8. #8
    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: Close Browser at the end of the Test

    See this post
    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

  9. #9
    Apprentice
    Join Date
    May 2004
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    Hi,

    that's a description how to do it on startup of the test, i would prefer to do the cleanup wenn a test finishes.

  10. #10
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Close Browser at the end of the Test

    U can use the Run Status at the end of the test and then close the browsers based on the test run status.
    Thanks,
    Ganesh Iyer
    Winds of Change

 

 
Page 1 of 3 123 LastLast

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.71%
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 07:56 AM.

Copyright BetaSoft Inc.