0

I'm trying to verify that a button loacted within my test page has a 'disabled' attribute applied to it. Here is the code:

<button type="button" class="btn-1" data-type="plus" data-field="quantity" disabled="disabled">

How would I go about getting a handle on the 'disabled' attribute?

Many thanks for your help

Banjaxx
  • 624
  • 2
  • 18
  • 34

1 Answers1

1

I am not using c# but i think you can use getAttribute() method from Webdriver Api.

c# getAttribute

So it should be something like that:

IWebElement button = locator to button;
button.getAttribute("disabled");

And then you can assert this value etc.

y3zier
  • 404
  • 2
  • 4
  • This is the correct answer. Remember "disabled" can have multiple values: http://stackoverflow.com/questions/6961526/correct-value-for-disabled-attribute so it's up to you to ensure you cater for them. – Arran Sep 22 '14 at 14:30