How to handle a Java Script pop up?

How to handle a Java Script pop up ?

Hi Noah Smith,

To handle a Java Script pop up, you can refer to the below sample code

  {
        wait.Until(ExpectedConditions.AlertIsPresent());    
        if (accept)
        {
            Driver().Instance.SwitchTo().Alert().Accept();
        }
        else
        {
            Driver().Instance.SwitchTo().Alert().Dismiss();
        }    
    }
    catch (WebDriverTimeoutException) { /*Alert did not appear, do nothing*/ }
}