Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

WebTest: how to close browser window?

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
I am using WebTest in SOAtest 6.1. I am running multiple test suites at one time and every time one suite is finished, I like to close the IE or Firefox browser completely before the next suite starts.

How can I do that? Do I need to write a script to complete this task?

Thanks.

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    1) Right Click - Add New - Test - in the Scenario Node
    2) Standard Test - Browser Testing Tool
    3) Go to User Action Tab in the new Browser Functional Test created
    4) Select Action Close from the drop down menu
    5) Select the window you would like closed.

    I am using WebTest in SOAtest 6.1. I am running multiple test suites at one time and every time one suite is finished, I like to close the IE or Firefox browser completely before the next suite starts.

    How can I do that? Do I need to write a script to complete this task?

    Thanks.

  • Test
    Test Posts: 5

    Hi,
    The 'Close' action closes indeed the browser completely. However, I would like to check if the accept dialogue 'Leave site' is shown. This dialogue is not shown when using the 'close' action. Is there a way to simulate closing the tab within chrome in order to show the accept dialogue? Thanks.

  • jakubiak
    jakubiak Posts: 813 admin

    No, SOAtest does not have a builtin way to do this. You could try to create an Execute Javascript command that calls "window.close()", but I'm not too optimistic that it will work.

  • Test
    Test Posts: 5

    Thanks. I have a not so pretty workaround now, but it works. The window.close() works only when the window was opened with javascript. This is what I do now:

    • Use the "Navigate" user action to open a browser session. I don't know how to do this with javascript, so I chose the parasoft user action.
    • Use javascript to open a tab or window. function myFunction() {
      window.open("");
      }

    • Close first window with parasoft user action "Close".

    • Close the second window with javascript to check if dialog is shown: function closeCurrentWindow() {
      window.close();
      }

    • Use the user action "Accept script dialog" or "Dissmiss script dialog" to either leave or stay on the page.