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.