Joris Mans Joris Mans - 4 months ago 16
HTML Question

Which div to programmatically click to close bootstrap modal

I am writing tests for my Bootstrap 3.x webapp using Nightwatch. All is working fine, but I would like to add the "close modal by clicking somewhere next to it" in one of my tests. I don't seem to be able to identify the html element that's supposed to receive the click event however.

Can anyone help me with this?

Thanks!

Answer

The background is a div with class .modal-backdrop. According to the docs: "...generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal."