Selenium WebDriver how to close browser popup

前端 未结 9 1087
悲&欢浪女
悲&欢浪女 2020-11-27 18:29

I am writing tests for a web App using selenium webDriver and came across a scenario where when I try to close the browser I get a popup saying \"Are you sure? The page is a

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 19:06

     ( ( JavascriptExecutor ) _driver )
                .executeScript( "window.onbeforeunload = function(e){};" );
    

    solved the issue for me

提交回复
热议问题