Closed Bug 1200366 Opened 10 years ago Closed 8 years ago

Get element attribute for a boolean attribute should return true or null

Categories

(Remote Protocol :: Marionette, defect)

43 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: barancev, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36 Steps to reproduce: For an element with no 'required' attribute: INFO: Executing: getElementAttribute [9ca70b03-b125-407a-b412-894d03305729, getElementAttribute {id=2f62a8a9-45b4-4c99-a685-9a32f9758e57, name=required}] 1441047188564 Marionette DEBUG conn0 -> ({"name":"getElementAttribute","parameters":{"id":"2f62a8a9-45b4-4c99-a685-9a32f9758e57","name":"required"},"sessionId":"9ca70b03-b125-407a-b412-894d03305729","to":"0"}) 1441047188565 Marionette DEBUG conn0 client <- ({"from":"0","value":"false","status":"success","sessionId":"9ca70b03-b125-407a-b412-894d03305729"}) ERROR:webdriver::server: Returning status Ok ERROR:webdriver::server: Returning body {"value":"false"} Actual results: The operation returns false Expected results: The operation should return null. See https://w3c.github.io/webdriver/webdriver-spec.html#get-element-attribute, point 6
I'm not sure if this is the same bug, but readOnly should be a boolean I believe and it is returning: -> GET session/c6578bc1-f702-5a4b-8ffd-d111ddb1ef02/element/f734a768-ad12-c24f-bd8f-6b02f1880182/attribute/readOnly <- {"value":"readonly"}
Neither of you said which version of Firefox you were running this against, but I believe it was fixed by http://hg.mozilla.org/mozilla-central/rev/a8d2a36786aa, which is bug 1272653. This is available in Firefox 48 onwards. Can either of you confirm?
My issue with readOnly returning a string instead of true/null is from Firefox Nightly
On Firefox 51.0a1 from a couple days ago, I get nowrap returning "" if present (incorrect), and null if absent (correct). nowrap sucks, so I'd be OK with an answer of "well, don't use nowrap", but FWIW, nowrap is one of the boolean attributes specifically called out in the docs for getAttribute in the Java bindings. It's also present in the Java tests. http://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#getAttribute-java.lang.String-
since Selenium is injecting getAttribute element this is not an issue anymore
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.