disabled: comes out as "true" but needs to go in as "disabled" ?

ยอดดู 16 ครั้ง
ข้ามไปที่ข้อความที่ยังไม่อ่านรายการแรก

Andrew

ยังไม่อ่าน,
3 ม.ค. 2555 15:22:473/1/55
ถึง clj-we...@googlegroups.com
Firebug shows a particular element on my web page as this:

<input class="check-box" type="checkbox" disabled="disabled" checked="checked">

After finding the element as e...

(attribute e :disabled)
==> "true"

(find-it b {:disabled "true"})
==> #clj_webdriver.element.Element{:webelement nil}

(find-it b {:disabled "disabled"})
==> #clj_webdriver.element.Element{:webelement #<Tag: <input>, Class: check-box, Value: on, Object: org.openqa.selenium.firefox.FirefoxWebElement@ed559a89>}

(= e (find-it b {:disabled "disabled"}))
==> true

semperos

ยังไม่อ่าน,
3 ม.ค. 2555 19:34:433/1/55
ถึง clj-we...@googlegroups.com
Andrew,

This is accidental complexity introduced by Selenium-WebDriver. They explain that a number of attributes are treated as "boolean" attributes and thus return true/false as a "feature:"


Given that the value for these attributes is the same as the attribute name, and that I can only imagine checking if something is disabled or not (a boolean check), does it makes sense to "normalize" the `.getAttribute` method on the Clojure side by making something like `(attribute element :disabled)` return "disabled" (a truthy value) instead of "true" (also a truthy value)?

Your thoughts?

semperos

ยังไม่อ่าน,
3 ม.ค. 2555 19:38:063/1/55
ถึง clj-we...@googlegroups.com
Well, I take some of that back. If you asked `(attribute element :disabled)` on an element that is not disabled, you get "false" (the String "false"), which would be truthy value. That is wrong.

I'll make it consistent with other calls to `attribute`, and clj-webdriver will just have the burden of keeping the list of "boolean" attributes that we're normalizing up-to-date.

Thanks for catching this.

-Daniel

Andrew

ยังไม่อ่าน,
4 ม.ค. 2555 16:02:304/1/55
ถึง clj-we...@googlegroups.com
Thanks. I think the same thing might apply to :checked

semperos

ยังไม่อ่าน,
4 ม.ค. 2555 16:11:384/1/55
ถึง clj-we...@googlegroups.com
It does, and to many others:


The fix for this was added to the alpha3 release, give it a whirl.

-Daniel
ตอบทุกคน
ตอบกลับผู้สร้าง
ส่งต่อ
ข้อความใหม่ 0 รายการ