Apply Button xpath not different when clickable and not clickable

This looks like the class you need to watch out for:

So an xpath something like this will identify that the button is disabled:

//button[contains(@class, "button--disabled")]/div[@class="button-content"]

So you could reverse this with something like:

//button[not(contains(@class, "button--disabled"))]/div[@class="button-content"]

to detect that the button is enabled.

You could also use the aria-disabled attribute:

Or the disabled attribute:

Looks like you have lots of options to play with.

Dave.

1 Like