Skip to content

Commit 3cc704f

Browse files
committed
Simulating submit operation for standard compliant drivers
1 parent bd32e3d commit 3cc704f

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ public void click() {
8585
}
8686

8787
public void submit() {
88-
execute(DriverCommand.SUBMIT_ELEMENT, ImmutableMap.of("id", id));
88+
if (parent.getW3CStandardComplianceLevel() == 0) {
89+
execute(DriverCommand.SUBMIT_ELEMENT, ImmutableMap.of("id", id));
90+
} else {
91+
WebElement form = findElement(By.xpath("./ancestor-or-self::form"));
92+
parent.executeScript("arguments[0].submit()", form);
93+
}
8994
}
9095

9196
public void sendKeys(CharSequence... keysToSend) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public void testHandlesTwoAlertsFromOneInteraction() {
346346

347347
@JavascriptEnabled
348348
@Test
349-
@Ignore({CHROME, MARIONETTE})
349+
@Ignore({CHROME})
350350
public void testShouldHandleAlertOnPageLoad() {
351351
driver.findElement(By.id("open-page-with-onload-alert")).click();
352352

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ public void testShouldBeAbleToFindAnElementByBooleanAttributeUsingCssSelector()
542542
}
543543

544544
@Test
545-
@Ignore(MARIONETTE)
546545
public void testShouldBeAbleToFindAnElementByBooleanAttributeUsingShortCssSelector() {
547546
driver.get(appServer.whereIs("locators_tests/boolean_attribute_selected.html"));
548547
WebElement element = driver.findElement(By.cssSelector("option[selected]"));

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,28 @@ public void testShouldBeAbleToClickImageButtons() {
7373
}
7474

7575
@Test
76-
@Ignore(MARIONETTE)
7776
public void testShouldBeAbleToSubmitForms() {
7877
driver.get(pages.formPage);
7978
driver.findElement(By.name("login")).submit();
8079
wait.until(titleIs("We Arrive Here"));
8180
}
8281

8382
@Test
84-
@Ignore(MARIONETTE)
8583
public void testShouldSubmitAFormWhenAnyInputElementWithinThatFormIsSubmitted() {
8684
driver.get(pages.formPage);
8785
driver.findElement(By.id("checky")).submit();
8886
wait.until(titleIs("We Arrive Here"));
8987
}
9088

9189
@Test
92-
@Ignore(MARIONETTE)
9390
public void testShouldSubmitAFormWhenAnyElementWithinThatFormIsSubmitted() {
9491
driver.get(pages.formPage);
9592
driver.findElement(By.xpath("//form/p")).submit();
9693
wait.until(titleIs("We Arrive Here"));
9794
}
9895

9996
@Test(expected = NoSuchElementException.class)
100-
@Ignore(value = {PHANTOMJS, SAFARI, MARIONETTE})
97+
@Ignore(value = {PHANTOMJS, SAFARI})
10198
public void testShouldNotBeAbleToSubmitAFormThatDoesNotExist() {
10299
driver.get(pages.formPage);
103100
driver.findElement(By.name("SearchableText")).submit();
@@ -197,7 +194,7 @@ public void testShouldBeAbleToSendKeysToAFileUploadInputElementInAnXhtmlDocument
197194
assertTrue(uploadPath.endsWith(file.getName()));
198195
}
199196

200-
@Ignore(value = {SAFARI, MARIONETTE},
197+
@Ignore(value = {SAFARI},
201198
reason = "Does not yet support file uploads", issues = {4220})
202199
@Test
203200
public void testShouldBeAbleToUploadTheSameFileTwice() throws IOException {
@@ -265,7 +262,7 @@ public void testEmptyTextBoxesShouldReturnAnEmptyStringNotNull() {
265262
}
266263

267264
@Test
268-
@Ignore(value = {PHANTOMJS, SAFARI, MARIONETTE, HTMLUNIT},
265+
@Ignore(value = {PHANTOMJS, SAFARI, HTMLUNIT},
269266
reason = "HtmlUnit: error; others: untested")
270267
public void handleFormWithJavascriptAction() {
271268
String url = appServer.whereIs("form_handling_js_submit.html");

0 commit comments

Comments
 (0)