How to check if an element is clickable using Protractor test

javascript, protractor, testing

Solution

I don't know about protractor, but using plain JS you can do:

window.getComputedStyle(element).getPropertyValue('pointer-events') == 'none';

however support for getComputedStyle may not be available in all browsers you wish to support, see MDN compatibility matrix, which indicates no support in IE 8, however it may not support the pointer-events CSS property anyway.

Problem

I have an element that does not allow it to be clickable using CSS property `pointer-events: none;` How can I check whether that element is clickable or not as doing a `.click()` on the element throws an exception that I cannot catch `UnknownError: unknown error: Element is not clickable at point` The element is a link so I just want to check if the redirect happened but because of this error it ends the test right away and try catch cannot catch the exception.

Original source