Skip to content
Browse files

Fixes #25: Normalize attributes that SW considers 'boolean' to behave…

… like all others when queried by the attribute fn
  • Loading branch information...
1 parent 90ceb4b commit 48bef86e33d88539830f00f09c1dccf9243095be @semperos semperos committed Jan 4, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 src/clj_webdriver/core_element.clj
View
16 src/clj_webdriver/core_element.clj
@@ -5,7 +5,21 @@
;; Element action basics
IElement
(attribute [element attr]
- (.getAttribute (:webelement element) (name attr)))
+ (let [attr (name attr)
+ boolean-attrs ["async", "autofocus", "autoplay", "checked", "compact", "complete",
+ "controls", "declare", "defaultchecked", "defaultselected", "defer",
+ "disabled", "draggable", "ended", "formnovalidate", "hidden",
+ "indeterminate", "iscontenteditable", "ismap", "itemscope", "loop",
+ "multiple", "muted", "nohref", "noresize", "noshade", "novalidate",
+ "nowrap", "open", "paused", "pubdate", "readonly", "required",
+ "reversed", "scoped", "seamless", "seeking", "selected", "spellcheck",
+ "truespeed", "willvalidate"]
+ webdriver-result (.getAttribute (:webelement element) (name attr))]
+ (if (some #{attr} boolean-attrs)
+ (if (= webdriver-result "true")
+ attr
+ nil)
+ webdriver-result)))
(click [element]
(.click (:webelement element))

0 comments on commit 48bef86

Please sign in to comment.
Something went wrong with that request. Please try again.