
This is the same application we introduced while discussing Select class earlier in this series. We have designed a web page in a way to include a few fundamental types of web elements. Let us move ahead and look at the actual implementation. There are the four methods that we would be using along with the Alert interface.ġ) void dismiss() – The dismiss() method clicks on the “Cancel” button as soon as the pop up window appears.Ģ) void accept() – The accept() method clicks on the “Ok” button as soon as the pop up window appears.ģ) String getText() – The getText() method returns the text displayed on the alert box.Ĥ) void sendKeys(String stringToSend) – The sendKeys() method enters the specified string pattern into the alert box. WebDriver offers the users with a very efficient way to handle these pop ups using Alert interface. Let us see how do we handle them using WebDriver. So ahead of the session, let’s see how do we reject or accept the alerts depending on their types. As soon as I click on the delete button, the system warns me against my action, prompting – Do you really want to delete the file? So now we have an option to either accept this alert or reject it. So in order to delete, I clicked on the delete button.

Later on, I wish to delete the uploaded photograph. It is nothing but a small box that appears on the display screen to give you some kind of information or to warn you about a potentially damaging operation or it may even ask you for the permissions for the operation.Įxample: Let us consider a real-life example for a better understanding Let us assume that we uploaded a photograph on any of these popular social networking sites.

What is Alert box/ Pop up box/ confirmation Box/ Prompt/ Authentication Box? Owing to the diversity in types of pop ups complexes the situation even more.

Handling pop up is one of the most challenging pieces of work to automate while testing web applications.
#Facebook webdrive php assert windows
There are two types of alerts that we would be focusing on majorly:Īs we know that handling windows based pop-ups is beyond WebDriver’s capabilities, thus we would exercise some third-party utilities to handle window pop-ups.
