From d101726c2ee39df5def989d1514fd3497e3b6484 Mon Sep 17 00:00:00 2001 From: AutomatedOwl <31897828+AutomatedOwl@users.noreply.github.com> Date: Fri, 6 Jul 2018 17:20:21 +0300 Subject: [PATCH] Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 5602119..5977cea 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,11 @@ Java library which allows to easily collect JavaScript errors received in Chrome site88Page.getTestButton().click(); waitBeforeClosingBrowser(); } + + @AfterEach + void closeDriver() { + driver.quit(); + } ``` ### Example of TestNG usage: @@ -57,8 +62,17 @@ public class JSCollectorTestNGTest { site88Page.getTestButton().click(); waitBeforeClosingBrowser(); } + + @AfterMethod + void closeDriver() { + driver.quit(); + } ``` +### Closing your browser session + +In order for the errors comparison to work properly, you should use 'AfterMethod' in TestNG and 'AfterEach' in JUnit in order to call driver.quit(). This would allow the listeners to interact with your WebDriver object after test execution. + ### Annotation values By default, using the annotation will cause your test to fail on JS errors received during Chromedriver session,