Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to click on alert box ok button using nightwatch.js

I am working on ui automation testing using nightwatch.js, i am struggling on a point, i want to click on alert box's "OK" button but i am unable to do it because i didn't find anyway to press alert box's "OK" button on browser using nightwatch.js.

is there any way please suggest.

like image 522
Ashish-BeJovial Avatar asked Feb 09 '16 08:02

Ashish-BeJovial


1 Answers

You can use the Selenium acceptAlert protocol. It can be used like this:

browser
.url(APP_ROOT)
.waitForElementVisible('.classThatOpensAlert', 2000)
.click('.classThatOpensAlert')
.pause(1000)
.acceptAlert()
like image 131
Fredrik Schöld Avatar answered Nov 02 '22 00:11

Fredrik Schöld