Is it possible to handle a JavaScript pop up in Pytest?
Hi Devan,
To handle a JavaScript pop up in Pytest, you can refer 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*/ }
}