vendredi 26 mars 2021

Click on pop up/ alert to launch web app using selenium

Currently in my tests when i select a button a pop up appears asking me to launch my web application Pop Up

However I cant seem to switch onto this pop up as if its a window

    new WebDriverWait(driver,5).until(ExpectedConditions.numberOfWindowsToBe(2));


    Set<String> allHandles = driver.getWindowHandles();
    for(String winHandle:allHandles)
    {
        if (!first_handle.equalsIgnoreCase(winHandle))
        {
            driver.switchTo().window(winHandle);
        }
    }

And I also attempted to accept it as an alert, but it didnt recognise it as an alert

Alert alert = driver.switchTo().alert();
// Alert present; set the flag
presentFlag = true;
// if present consume the alert
alert.accept();

Ive seen suggestions to disable notifications and they dont work either, my main aim is to select the open button but I cant get any elements to select from the console either




Aucun commentaire:

Enregistrer un commentaire