Closed Bug 1430575 Opened 8 years ago Closed 8 years ago

Unable clear <input type=number> after typing invalid data into it

Categories

(Remote Protocol :: Marionette, defect, P1)

59 Branch
defect

Tracking

(firefox-esr52 unaffected, firefox57 unaffected, firefox58 unaffected, firefox59 fixed)

RESOLVED FIXED
mozilla59
Tracking Status
firefox-esr52 --- unaffected
firefox57 --- unaffected
firefox58 --- unaffected
firefox59 --- fixed

People

(Reporter: barancev, Assigned: ato)

References

(Blocks 1 open bug, )

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36 Steps to reproduce: Detected in Firefox Nightly 59.0a1 (2018-01-14) (64-bit) Regression issue, may be caused by https://bugzilla.mozilla.org/show_bug.cgi?id=1354211 driver.get("https://output.jsbin.com/serilo"); WebElement numInput = driver.findElement(By.id("num")); numInput.sendKeys("test"); numInput.clear(); numInput.sendKeys("33"); assertEquals(numInput.getAttribute("value"), "33"); Actual results: getAttribute returns empty value, but visually the field contains text "test33" Expected results: getAttribute should return value "33"
Andreas, can you please have a look?
Blocks: 1354211
Status: UNCONFIRMED → NEW
Component: General → Marionette
Ever confirmed: true
Flags: needinfo?(ato)
Keywords: regression
This appears to be a bug in the WebDriver standard. We abort modifying the element if it is empty, which for an <input> is if its value property is equal to "" (empty string). The complication is that whilst it is allowed to enter invalid characters to an <input type=number> in Gecko, it is not in Chrome. This means this particular WebDriver bug will only occur in Gecko because the value property isn’t updated when the input is invalid. As far as I know there is no way with current web platform APIs to access the current (invalid) input of <input type=number>. But we can additionaly make a check of its ValidityState [1], since the value === "" check is not sufficient. I filed [2] against the WebDriver specification. Regarding the above test case, you should be getting the input’s _property_ rather than the value, but I corrected this in my own test case. [1] https://html.spec.whatwg.org/#validitystate
Assignee: nobody → ato
Blocks: webdriver
Status: NEW → ASSIGNED
Flags: needinfo?(ato)
OS: Unspecified → All
Hardware: Unspecified → All
Summary: Can't clear number input after typing invalid data into it → Unable clear <input type=number> after typing invalid data into it
[Mass update] Setting P1 as currently being worked on.
Priority: -- → P1
I want to make a note that it works in the current Release (57) and used to work in 59 before the mentioned change https://bugzilla.mozilla.org/show_bug.cgi?id=1354211. So I suppose it is technically possible to implement "old" behaviour. But, yes, it should be coherrent with the specification.
Blocks: 1430571
Comment on attachment 8942692 [details] Bug 1430575 - Adjust editable definition to match WebDriver. https://reviewboard.mozilla.org/r/212954/#review218654
Attachment #8942692 - Flags: review?(dburns) → review+
Comment on attachment 8942693 [details] Bug 1430575 - Document interaction.clearElement. https://reviewboard.mozilla.org/r/212956/#review218656 ::: testing/marionette/interaction.js:295 (Diff revision 2) > }; > > +/** > + * Clears the form control or the editable element, if required. > + * > + * Before attempting to clear the element, it will be attempted s/attempted scrolled into view/attempt to scroll into view ::: testing/marionette/interaction.js:300 (Diff revision 2) > + * Before attempting to clear the element, it will be attempted > + * scrolled into view if it is not already in the viewport. > + * > + * If the element is a submittable form control and it is empty > + * (it has no value or it has no files associated with it, in the > + * case it is a <code>&lt;input type=file>&gt; element) or it is an closing `</code>` is missing which could explain the `>` next to `type=file`
Attachment #8942693 - Flags: review?(dburns) → review+
Comment on attachment 8942694 [details] Bug 1430575 - Add element.satisfiesContraints. https://reviewboard.mozilla.org/r/212958/#review218664 ::: testing/marionette/element.js:964 (Diff revision 2) > + * True if it satisfies all its constraints. > + * > + * @throws {InvalidElementStateError} > + * If <var>el</var> is not a mutable form control element. > + */ > +element.satisfiesConstraints = function(el) { I don't like this this method name as it looks like it should be used as `element.satisiesConstraints(el, constraint);` As the method is so small why can't this just be in method where you call `element.satisfiesConstraints(el);` in your other patch
Attachment #8942694 - Flags: review?(dburns) → review-
Comment on attachment 8942694 [details] Bug 1430575 - Add element.satisfiesContraints. https://reviewboard.mozilla.org/r/212958/#review218664 > I don't like this this method name as it looks like it should be used as `element.satisiesConstraints(el, constraint);` > > As the method is so small why can't this just be in method where you call `element.satisfiesConstraints(el);` in your other patch I agree. Merging it with clearResettableElement in testing/marionette/interaction.js makes the code flow much nicer.
Attachment #8942694 - Attachment is obsolete: true
Comment on attachment 8942695 [details] Bug 1430575 - Add validity state check for WebDriver:ElementClear. https://reviewboard.mozilla.org/r/212960/#review219316
Attachment #8942695 - Flags: review?(dburns) → review+
Pushed by atolfsen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2f1762f3233a Adjust editable definition to match WebDriver. r=automatedtester https://hg.mozilla.org/integration/autoland/rev/7220cf5de9a8 Document interaction.clearElement. r=automatedtester https://hg.mozilla.org/integration/autoland/rev/949cf88764e6 Add validity state check for WebDriver:ElementClear. r=automatedtester
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: