Forum Discussion

grace_ca's avatar
grace_ca
Occasional Contributor
4 years ago
Solved

How to perform on error close browser event?

Hi There   There is a annotation of @Before and @After(teardown) in Cucumber-JVM framework, which closes all the browsers on error. I am looking for the similar action in testComplete. The closest ...
  • grace_ca's avatar
    grace_ca
    4 years ago

    Yes. I did.

    When I added the onStopTest event control the popup ask you to select a test. It adds a function to that test script.

    I added content.

    function EventControl1_OnStopTest(Sender)
    {
    let browser = Aliases.browser;
    browser.Close();
    }

     

    At project level when I run the item I select the event/mehod.

    What is the sender parameter should it be? I don't any parameters. I am using script mode.

    Thanks!

  • grace_ca's avatar
    grace_ca
    4 years ago

    Thanks Alex!

    I tried on my script with the event control it worked.  Just I don't know why it didn't work in project execution.

    Thanks for your help!