If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

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

RESOLVED FIXED in mozilla27

Status

Testing
Marionette
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: zac, Assigned: automatedtester)

Tracking

unspecified
mozilla27
ARM
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 3 obsolete attachments)

(Reporter)

Description

5 years ago
Created attachment 703618 [details]
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.
Blocks: 801898
CC'ing David Burns for his input.

Updated

5 years ago
OS: Windows 7 → Gonk (Firefox OS)
Hardware: x86_64 → ARM
(Assignee)

Comment 2

5 years ago
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
(Assignee)

Comment 3

4 years ago
can't seem to see the issue. Pushed https://tbpl.mozilla.org/?tree=Try&rev=410dec044941 to try to see I could reproduce elsewhere.
(Assignee)

Comment 4

4 years ago
loos like I forgot the html file added and new tries

https://tbpl.mozilla.org/?tree=Try&rev=885a6cf483c0
https://tbpl.mozilla.org/?tree=Try&rev=ad05bde5afe4
(Assignee)

Updated

4 years ago
Flags: needinfo?(dburns)
(Assignee)

Comment 5

4 years ago
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)
(Assignee)

Comment 6

4 years ago
https://tbpl.mozilla.org/?tree=Try&rev=c8c2e8d5351b
https://tbpl.mozilla.org/?tree=Try&rev=2aca65ba7498
(Assignee)

Comment 7

4 years ago
Created attachment 806691 [details] [diff] [review]
try: -b do -p linux,macosx64,win32 -u marionette -t none
(Assignee)

Comment 8

4 years ago
Created attachment 806692 [details] [diff] [review]
try: -b do -p linux,macosx64,win32 -u marionette -t none
(Assignee)

Updated

4 years ago
Attachment #806691 - Attachment is obsolete: true
(Assignee)

Comment 9

4 years ago
Created attachment 806703 [details] [diff] [review]
bug832045.patch
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?
(Assignee)

Comment 12

4 years ago
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?
(Assignee)

Updated

4 years ago
Attachment #806703 - Flags: review?(jgriffin)
Yes, might as well land the test!
(Assignee)

Comment 14

4 years ago
Created attachment 806895 [details] [diff] [review]
bug832045.patch

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+
(Assignee)

Comment 16

4 years ago
test landed in https://hg.mozilla.org/integration/mozilla-inbound/rev/06141d2c7302
https://hg.mozilla.org/mozilla-central/rev/06141d2c7302
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.