Skip to content
Advertisement

If statement of a disabled button in Java Script for Protractor tests

I have the following issue:

  • I have a page where the “Save button” becomes clickable only when I enter a certain value inside a text filed.
  • What I want to do is to check that if the Save button is disabled, then I need to enter some value in that text field.

What I thought is to have something like this:

JavaScript

What I couldn’t do is to store the value of the save button being disabled into a Boolean variable.

Thank you!

Advertisement

Answer

You can use getAttribute() int his way:

JavaScript

Docs here

So to your purpose you can use something like this:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement