How to handle a JavaScript pop-up using SpecFlow?

How can I handle a JavaScript pop-up using SpecFlow?

Hello Charity,

You can refer the below sample code:

try
    {
        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*/ }
}