Skip to content

Commit

Permalink
Revert "Dispatch form "submit" event on window to prevent a form doub…
Browse files Browse the repository at this point in the history
…le submission (SeleniumHQ#6361)"

This reverts commit 58e75ca.
  • Loading branch information
barancev authored and Grigory Mischenko committed Sep 20, 2018
1 parent bc6b7e9 commit c673fe9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions py/selenium/webdriver/remote/webelement.py
Expand Up @@ -84,10 +84,9 @@ def submit(self):
if self._w3c:
form = self.find_element(By.XPATH, "./ancestor-or-self::form")
self._parent.execute_script(
"var win = arguments[0].ownerDocument;"
"var e = win.createEvent('Event');"
"var e = arguments[0].ownerDocument.createEvent('Event');"
"e.initEvent('submit', true, true);"
"if (win.dispatchEvent(e)) { arguments[0].submit() }", form)
"if (arguments[0].dispatchEvent(e)) { arguments[0].submit() }", form)
else:
self._execute(Command.SUBMIT_ELEMENT)

Expand Down

0 comments on commit c673fe9

Please sign in to comment.