Praveesh P Praveesh P - 9 months ago 57
Javascript Question

Click on a button in a Modal Window - Protractor

I'm writing protractor tests for an existing app.
I have a button called 'Decline' in a modal window, and I'm trying to click it using:


But I receive the below error:

UnknownError: unknown error: Element is not clickable at point (,). Other element would receive the click:

May be because I have another button called 'Decline' outside the modal window?

enter image description here

How do I click on the modal window's Decline button ?

Found that this is the js code that displays this Decline button.

var content = {
title: 'Decline',
htmlBody: '<p>...</p> ',
okButton: 'Decline',
onOk: function() {

Answer Source

My Colleague recommended this and it worked worked :

Clicking on First Decline button opens up a modal, and then sleep for some time, click on the second Decline button.

element(by.cssContainingText('.btn', 'Decline')).click();

Thanks for all your help :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download