From 375343ec9181b1136ff4c92630f762e995e2b297 Mon Sep 17 00:00:00 2001 From: Alexei Barantsev Date: Thu, 6 Sep 2018 15:12:59 +0300 Subject: [PATCH] [java] Dispatch form "submit" event on window to prevent a form double submission --- .../org/openqa/selenium/remote/http/W3CHttpCommandCodec.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/client/src/org/openqa/selenium/remote/http/W3CHttpCommandCodec.java b/java/client/src/org/openqa/selenium/remote/http/W3CHttpCommandCodec.java index c98a2856b0e39..82bc6c4100872 100644 --- a/java/client/src/org/openqa/selenium/remote/http/W3CHttpCommandCodec.java +++ b/java/client/src/org/openqa/selenium/remote/http/W3CHttpCommandCodec.java @@ -365,7 +365,7 @@ public W3CHttpCommandCodec() { "if (!form.ownerDocument) { throw Error('Unable to find owning document'); }\n" + "var e = form.ownerDocument.createEvent('Event');\n" + "e.initEvent('submit', true, true);\n" + - "if (form.dispatchEvent(e)) { HTMLFormElement.prototype.submit.call(form) }\n", + "if (form.ownerDocument.dispatchEvent(e)) { HTMLFormElement.prototype.submit.call(form) }\n", asElement(parameters.get("id"))); default: