Selenium Interview Question 11 – Which Class Implements Alert Interface in Selenium WebDriver?

As a part of Selenium Interview Questions series, in this post, we will see about Implement class of Alert interface.

Someone asked me this question and I felt this is good to share with others as well. So here is the post for the same.

Honestly, I was also not aware of this. So I started researching.

First I went to Alert interface Javadoc. I did not find any implemented class information there.

Then I looked at RemoteWebDriver Javadoc as it is concrete immediate class of WebDriver interface. There I got my answer.

There is an inner class named “RemoteAlert ” which implements Alert interface and define methods declared in Alert interface as shown above.

When we use switchTo().alert() method, it returns a reference of RemoteAlert class which is up cast to Alert interface.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyLearning

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

2 thoughts on “Selenium Interview Question 11 – Which Class Implements Alert Interface in Selenium WebDriver?

Leave a Reply to Amod Mahajan Cancel reply

Your email address will not be published. Required fields are marked *