简体   繁体   中英

Click a button on a Browser native Javascript pop up alert window Selenium/C#

There is a Delete button on the form, once it gets clicked, a Browser native pop up alert window is asking to confirm the action. How can I click on OK since I can't see any html of that window?

要在警报上单击“确定”:

driver.SwitchTo().Alert().Accept();

window.confirm() returns Boolean value.

true if OK is clicked and false if Cancel is clicked.

 console.log(window.confirm()); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM