Open
Bug 1416216
Opened 7 years ago
Updated 2 years ago
Extend click + page load to wait for `form.submit` event, if clicked element is a submit button
Categories
(Remote Protocol :: Marionette, defect, P2)
Tracking
(Not tracked)
NEW
People
(Reporter: whimboo, Unassigned)
References
(Blocks 1 open bug, )
Details
As shown in https://github.com/mozilla/geckodriver/issues/1026 our click + pageload logic fails if custom event handlers are in-place which delay the form submission. As such the beforeunload timer times out before the page gets loaded, and as such returns too early.
Example test:
def test_delayed_page_load(self):
self.marionette.timeout.implicit = 10
self.marionette.navigate("http://demo.litecart.net/admin/")
self.marionette.find_element(By.CSS_SELECTOR, "button[name=login]").click()
logout = self.marionette.find_element(By.CSS_SELECTOR, "a[title=Logout]")
logout.click()
Reporter | ||
Comment 1•7 years ago
|
||
Something we have to obey is to also register the onsubmit event listener for the capturing phase in case a custom listener on that page is using preventDefault. Also the registering has to happen before we click the element, and that no race conditions will occur.
I wonder if that is something we would have to add to the spec, because so far it only references the actual click event to wait for, but no other events which might also get fired as result of the click.
Comment 2•7 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #1)
> I wonder if that is something we would have to add to the spec,
> because so far it only references the actual click event to wait
> for, but no other events which might also get fired as result of
> the click.
I think probably it makes some sense to introduce this feature to
the specification. The Element Click command is meant to help
the user “do the right thing” when interacting with elements.
Waiting for a form’s submit DOM event is in line with the same
thinking that we have around flushing the event loop, or ensuring
that DOM events resulting from a click, successfully fire before we
return control to the user.
It is worth filing a bug on https://github.com/w3c/webdriver so we
can have the discussion in the proper forum. I think the hard part
to this discussion will not be whether or not to _do it_, but how
to ensure we escape if the form submission does not mature, e.g. an
event handler prevents the default action.
Reporter | ||
Comment 3•7 years ago
|
||
This is on file now for the webdriver specification: https://github.com/w3c/webdriver/issues/1166
Updated•2 years ago
|
Severity: normal → S3
Updated•2 years ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•