Closed Bug 832045 Opened 11 years ago Closed 11 years ago

[B2G] get_attribute('disabled') returns false regardless of disabled attribute

Categories

(Remote Protocol :: Marionette, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla27

People

(Reporter: zcampbell, Assigned: automatedtester)

References

Details

Attachments

(2 files, 3 obsolete files)

Attached file crude test case
Marionette is returning 'false' for every HTMLElement.get_attribute('disabled')

The element in question is the 'capture-button' in the camera app:
https://github.com/mozilla-b2g/gaia/blob/master/apps/camera/index.html#L24

After the app starts up the 'disabled' attribute is removed however marionette still returns 'false'.

Minimized test case.
CC'ing David Burns for his input.
OS: Windows 7 → Gonk (Firefox OS)
Hardware: x86_64 → ARM
If the element has a disabled attribute then we should return true and if it doesnt then we should a false

so <div disable=disable> should return true and <div> should return false. This is what has been discussed in the HTML5 spec[1] and thats what we should be following.

[1] http://www.whatwg.org/specs/web-apps/current-work/#boolean-attributes
can't seem to see the issue. Pushed https://tbpl.mozilla.org/?tree=Try&rev=410dec044941 to try to see I could reproduce elsewhere.
Flags: needinfo?(dburns)
This is working as it should, we mostly. Its not coercing the data returned to python primatives. 

e.g. AssertionError: True != u'true'. Will fix that in this bug
Flags: needinfo?(dburns)
Attachment #806691 - Attachment is obsolete: true
Attached patch bug832045.patch (obsolete) — Splinter Review
Attachment #806692 - Attachment is obsolete: true
Attachment #806703 - Flags: review?(jgriffin)
So, this is kind of a weird case.  DOM attributes are always strings, so even in JS, calling getAttribute('disabled') will return a string value, not a boolean.  This matches what the Selenium atom does, that we're using to get attribute values.

I'm not positive we want to cast this to a Boolean in Python, since it isn't how Selenium or DOM API's behave.
I guess, for consistency, we should do what the FirefoxDriver does...does it do this casting?
For some reason I thought we coerced it in the Selenium code... I could have sworn I wrote it that way originally but its not like that now so we will leave it as it is and close the bug. 

Happy to land the test as that might be useful. Thoughts?
Attachment #806703 - Flags: review?(jgriffin)
Yes, might as well land the test!
Attached patch bug832045.patchSplinter Review
just the test in the patch. MOAR TESTS!!!
Attachment #806703 - Attachment is obsolete: true
Attachment #806895 - Flags: review?(jgriffin)
Comment on attachment 806895 [details] [diff] [review]
bug832045.patch

Review of attachment 806895 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks.
Attachment #806895 - Flags: review?(jgriffin) → review+
https://hg.mozilla.org/mozilla-central/rev/06141d2c7302
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: