Diff between WebDriver listeners and TestNG listeners?

0 votes
I'm still a novice in Selenium...so can someone plz tell me the difference between TestNG listener and WebDriver listener? If I know the difference, I can start implementing them.
Apr 13, 2018 in Selenium by kappa3010
• 2,020 points
1,713 views

1 answer to this question.

0 votes
This is not a very important concept to know. But anyway, listeners are those which will be listening to any state change(event).

So in case of WebDriver, whenever anyone clicks on a button on a web page, then automatically a method will be called (actionPerformed() in ActionListener case).

But in case of TestNG, there are the actual "listeners" which listen (here the method gets called automatically) to the test execution events. A few examples are: onStart(), beforeStart(), afterFinish(), and onFinish() etc. Mostly, the TestNG automation teams implement their own custom listeners for custom Logging and reporting.

WebDriver listeners too do a similar job...of logging and/or reporting. But then both of them work on different event sets. WebDriver works on different automation events whereas TestNG works on different test's related events. The point to note is that, with WebDriver listeners, "Logging" happens before/after event occurance such as click/SendKeys etc.
answered Apr 13, 2018 by king_kenny
• 3,650 points

Related Questions In Selenium

0 votes
1 answer

What's the diff between Selenium RC and Selenium WebDriver?

RC works by injecting the JavaScript functions ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
200 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
5,568 views
0 votes
1 answer

Differences between Selenium IDE, Selenium RC and WebDriver

Selenium Ide is a Firefox plugin that ...READ MORE

answered Apr 19, 2018 in Selenium by Vardy
• 2,250 points
127 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
739 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
989 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
704 views
0 votes
2 answers

Selenium: Diff between POM (page object model) and page factory?

Hi, In POM (Page Object Model) you create ...READ MORE

answered Mar 14 in Selenium by Ellen Dares
2,818 views
0 votes
1 answer

What is the difference between thoughtworks.selenium and openqa.selenium selenium?

thoughtworks.selenium is the original Selenium (aka Selenium 1, ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,650 points
215 views