Closed
Bug 1417224
Opened 7 years ago
Closed 6 years ago
Element clear should work for date-input elements
Categories
(Remote Protocol :: Marionette, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1354211
People
(Reporter: fisherii, Unassigned)
References
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36 Steps to reproduce: Called WebElement.clear() on an element that was defined as: <input type="date"> Actual results: Got an exception: InvalidElementStateException: Message: Element must be user-editable in order to clear it. Expected results: Any date selected in the input element should have been cleared.
Comment 1•7 years ago
|
||
Thank you for reporting this failure. I had a look at it and can reproduce it very easily. Here an example test which demonstrates that behavior: def test_date_input(self): self.marionette.navigate(self.inline("""<input type="date">""")) input = self.marionette.find_element(By.TAG_NAME, "input") input.send_keys("2017-11-11") input.clear() In listener.js we make use of `atom.clearElement()` to clear the element. So it means that we need bug 1354211 to get this fixed.
Comment 2•7 years ago
|
||
For advanced control elements such as <input type=date> we probably need to follow the same recipe we use for interaction with <select> elements: https://searchfox.org/mozilla-central/rev/550148ab69b2879bfb82ffa698720ede1fa626f2/testing/marionette/interaction.js#239-287
Comment 3•7 years ago
|
||
I don't think so. I would assume blindly that this is really related to the `clearElement()` method which we use from Selenium atoms. Keep in mind that support for type date started with Firefox 57, so the method might be broken for Firefox.
Comment 4•7 years ago
|
||
I talked with Alexei and he will add some tests to the Selenium repository, because as it looks like there are none yet for those new types of input elements.
Comment 5•7 years ago
|
||
the spec clearly says text based inputs for #clear so we need to probably make handling these clearer
Comment 6•7 years ago
|
||
The spec says: > The Element Clear command scrolls into view an editable or resettable element and then attempts to clear its selected files or text content. `text content` also includes `Context object’s value`, and that is what a date input has: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Value Basically we should follow the `clear a resettable element` steps, right?
Comment 7•7 years ago
|
||
New tests: https://github.com/SeleniumHQ/selenium/commit/0233d3b4619528b127e087e4a994c8bb3cc5df58
Comment 8•6 years ago
|
||
I recently defined a new ‘clear algorithm’ concept in WebDriver, and for <input> elements it says: [1] > The clear algorithm for input elements is to set the dirty value > flag and dirty checkedness flag back to false, set the value of > the element to an empty string, set the checkedness of the element > to true if the element has a checked content attribute and false > if it does not, empty the list of selected files, and then invoke > the value sanitization algorithm, if the type attribute’s current > state defines one. This implies, like I may have incorrectly explained in comment #2, that we need to issue some focus events and probably a change event. I would quite like to see tests for this in WPT, considering we don’t run the Selenium tests against our implementation. [1] https://w3c.github.io/webdriver/webdriver-spec.html#dfn-clear-algorithm
Updated•6 years ago
|
Assignee: nobody → ato
Comment 9•6 years ago
|
||
I looked at this on a plane recently and wrote up a decent number of tests. I discovered that Marionette still uses a Selenium atom for the Element Clear command and that it is probably easier to rewrite the command as part of https://bugzilla.mozilla.org/show_bug.cgi?id=1354211 than it is to upgrade/monkey patch the atom.
Assignee: ato → nobody
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Updated•1 year ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•