user1243155
user1243155

Reputation: 37

How to determine the Disabled property of a 'Button' in Watir

How can i check the property of a button whether it is disabled or not? The below statement is sucessfull for its existence,

@browser.frame(:name => 'MainBody').button(:text => 'Submit').exists? 

.. can someone let me know how should i check the disabled property? Thank you!

Upvotes: 4

Views: 3534

Answers (2)

sebastian.cretu
sebastian.cretu

Reputation: 1

In watir-webdriver this can be done by editing the file: C:\Ruby193\lib\ruby\gems\1.9.1\gems\watir-webdriver-0.6.1\lib\watir-webdriver\elements\option.rb and before the def select, add this:

def enabled?
!disabled?
end

It worked for me, as watir-webdriver doesn't know about .enabled? on options for select_lists.

Upvotes: 0

p0deje
p0deje

Reputation: 4053

@browser.frame(:name => 'MainBody').button(:text => 'Submit').enabled?

Upvotes: 4

Related Questions