Skip to content

Commit c5b1e14

Browse files
committed
Fixing submit simulation for standard compliant drivers
1 parent 28f63e5 commit c5b1e14

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

java/client/src/org/openqa/selenium/remote/RemoteWebElement.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ public void submit() {
8989
execute(DriverCommand.SUBMIT_ELEMENT, ImmutableMap.of("id", id));
9090
} else {
9191
WebElement form = findElement(By.xpath("./ancestor-or-self::form"));
92-
parent.executeScript("arguments[0].submit()", form);
92+
parent.executeScript("var e = arguments[0].ownerDocument.createEvent('Event');" +
93+
"e.initEvent('submit', true, true);" +
94+
"if (arguments[0].dispatchEvent(e)) { arguments[0].submit() }", form);
9395
}
9496
}
9597

java/client/test/org/openqa/selenium/CorrectEventFiringTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ public void testSendingKeysToAFocusedElementShouldNotBlurThatElement() {
332332

333333
@JavascriptEnabled
334334
@Test
335-
@Ignore(MARIONETTE)
336335
public void testSubmittingFormFromFormElementShouldFireOnSubmitForThatForm() {
337336
driver.get(pages.javascriptPage);
338337
WebElement formElement = driver.findElement(By.id("submitListeningForm"));
@@ -341,7 +340,6 @@ public void testSubmittingFormFromFormElementShouldFireOnSubmitForThatForm() {
341340
}
342341

343342
@JavascriptEnabled
344-
@Ignore({MARIONETTE})
345343
@Test
346344
public void testSubmittingFormFromFormInputSubmitElementShouldFireOnSubmitForThatForm() {
347345
driver.get(pages.javascriptPage);
@@ -351,7 +349,6 @@ public void testSubmittingFormFromFormInputSubmitElementShouldFireOnSubmitForTha
351349
}
352350

353351
@JavascriptEnabled
354-
@Ignore({MARIONETTE})
355352
@Test
356353
public void testSubmittingFormFromFormInputTextElementShouldFireOnSubmitForThatFormAndNotClickOnThatInput() {
357354
driver.get(pages.javascriptPage);
@@ -404,7 +401,7 @@ public void testShouldReportTheXAndYCoordinatesWhenClicking() {
404401
}
405402

406403
@JavascriptEnabled
407-
@Ignore(value = {MARIONETTE}, reason = "Not tested")
404+
@Ignore(value = {MARIONETTE})
408405
@Test
409406
public void testClickEventsShouldBubble() {
410407
driver.get(pages.clicksPage);

java/client/test/org/openqa/selenium/FrameSwitchingTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ public void testShouldBeAbleToSwitchToParentFromAnIframe() {
305305
// ----------------------------------------------------------------------------------------------
306306

307307
@Test
308-
@Ignore(MARIONETTE)
309308
public void testShouldContinueToReferToTheSameFrameOnceItHasBeenSelected() {
310309
driver.get(pages.framesetPage);
311310

0 commit comments

Comments
 (0)