dimanche 21 février 2016

Make IAlert as Observer

I'm using last selenium some websites have randomly popup messages that stops the normally test process

What i'm thinking is that i need to do IAlert as Observer pattern that catches the alert accept it and continue the test from the point that its stopped for handling the popup.

IAlert Code:

try
{
    IAlert alert = driver.SwitchTo().Alert();
    if (alert != null)
    {
        alert.Accept();
    }
}
catch (Exception ex)
{}

The main question is how can i perform it or if there is a better way to handle randomly popups?

Thank's

Aucun commentaire:

Enregistrer un commentaire