Normalize `.getAttribute()` across attributes #25

semperos opened this Issue Jan 4, 2012 · 0 comments

1 participant


Selenium-WebDriver treats certain element attributes as "boolean" in nature, so when asking (attribute element :disabled) you get "true" or "false". This introduces accidental complexity and the return of "false" is a truthy value, which is not just accidentally complex but wrong. Here's the part of the API documentation that explains this:

The attribute function should instead normalize the return value of attributes such that "boolean" attributes according to Selenium-WebDriver are returned like all other "normal" attributes.

In short, this should be the behavior of attribute:

(attribute disabled-element :disabled)
;=> "disabled"

(attribute enabled-element :disabled)
;=> nil

Noted by @achengs on the Google Group here.

@semperos semperos added a commit that closed this issue Jan 4, 2012
@semperos Fixes #25: Normalize attributes that SW considers 'boolean' to behave…
… like all others when queried by the attribute fn
@semperos semperos closed this in 48bef86 Jan 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment