WebTest: how to close browser window?

LegacyForumLegacyForum Posts: 1,669 ✭✭
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

  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    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.

  • TestTest 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.

  • jakubiakjakubiak Posts: 570 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.

  • TestTest 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.

Sign In or Register to comment.