Search code examples
htmlangularjstestingprotractorend-to-end

How to determine if <a> is disabled


Protractor has the nifty isEnabled() function for elements. Though it works great for <button>, it isn't doing the trick for <a> elements.

I can easily check the disabled or ng-disabled attribute, but is there a cleaner way?


Solution

  • You need to get the attribute directly like this:

    expect(myelement.getAttribute('disabled')).toBeTruthy();
    

    I use this in my Protractor testing daily without issue.