ruby - Rspec; verifying an element state when the attribute that doesn't have a value -
i doing automation testing using rspec , watir.
verify presence of button element's attribute titled hidden
. in pseudo-code this:
find button element; press click verify button element has attribute titled "hidden" perform further actions
is possible find attributes of nature, or need hidden=hidden
?
you can use built-in hidden?
method:
<input type="submit" value="button"> browser.button.hidden? #=> false <input type="submit" value="button" hidden> browser.button.hidden? #=> true
then, can create rspec example uses expectation validate:
describe "button" "should hidden" expect(browser.button.hidden?).to true end end
and expect(browser.button.hidden?).to true
clunky. justin ko astutely points out, rspec provides syntactic sugar in form of predicate matchers make cleaner: expect(browser.button).to be_hidden
.
Comments
Post a Comment