What are Webdriver listeners and what are they used for

0 votes
What are Webdriver listeners in Selenium and what are they used for?
May 24, 2019 in Selenium by Dheeraj
1,115 views

1 answer to this question.

0 votes

Hi Dheeraj, Listeners “listen” to the event defined in the selenium script and behave accordingly. The main purpose of using listeners is to create logs and reports. There are many types of listeners such as WebDriver Event Listeners and TestNG Listeners. It is used in selenium by implementing Listeners Interface. There are many types of listeners available:

WebDriver works on different automation events whereas TestNG works on different test's related events. The main reason for WebDriver listeners is "Logging" before / after events like click / SendKeys etc. WebDriverEventListener interface allows us to implement the methods once the script is executed, Selenium WebDriver does perform activities such as Type, Click, Navigate etc, To keep track of these activities we use WebDriverEventListeners interface.

While, in case of TestNG there are listeners which listens the test execution events. For eg.onStart() beforeStart() afterFinish() onFinish() etc. Most of the times, In TestNG automation devs implements their own custom listeners for custom Logging and reporting.

answered May 25, 2019 by Lipi

Related Questions In Selenium

0 votes
1 answer

What are some of the most commonly used WebElement commands for Selenium Webdriver?

 Hey Rupali, some of the most commonly ...READ MORE

answered May 14, 2019 in Selenium by Abha
• 28,040 points
344 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,500 points
13,053 views
+1 vote
1 answer

What are the similarity between Selenium RC and Selenium Webdriver?

Selenium RC and Webdriver both support the ...READ MORE

answered Dec 12, 2018 in Selenium by Priyaj
• 58,140 points
397 views
0 votes
1 answer

What are the tools used for UI Testing?

The popular tools used for UI Testing ...READ MORE

answered Feb 15, 2019 in Selenium by Mehrin
153 views
0 votes
2 answers

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,500 points
6,030 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
6,462 views
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,890 points
4,088 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
5,064 views
0 votes
1 answer
0 votes
2 answers

What are Broken Links and why they needs to be checked?

@Umang, Broken link or dead link is a link on a web ...READ MORE

answered Aug 1, 2019 in Selenium by Abha
• 28,040 points
150 views