Skip to content

Commit

Permalink
Add test to ensure clicking on a disabled element is okay
Browse files Browse the repository at this point in the history
It's odd, but a user _could_ want to click on an element
that is disabled.
  • Loading branch information
shs96c committed Apr 11, 2017
1 parent d2e43e9 commit 6c7b4b4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
12 changes: 12 additions & 0 deletions common/src/web/click_tests/disabled_element.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Clicking on a disabled element</title>
</head>
<body>
<h1>See below</h1>
<form action="POST">
<input name="disabled" disabled="disabled" />
</form>
</body>
</html>
17 changes: 17 additions & 0 deletions java/client/test/org/openqa/selenium/ClickTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import static org.openqa.selenium.testing.TestUtilities.getEffectivePlatform;
import static org.openqa.selenium.testing.TestUtilities.isChrome;

import com.google.common.base.Throwables;

import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.testing.Ignore;
Expand Down Expand Up @@ -373,4 +375,19 @@ public void testShouldBeAbleToClickOnAPartiallyOverlappedLinkThatWrapsToTheNextL

wait.until(titleIs("Submitted Successfully!"));
}

@NotYetImplemented(MARIONETTE)
@Test
public void clickingOnADisabledElementIsANoOp() {
driver.get(appServer.whereIs("click_tests/disabled_element.html"));

WebElement element = driver.findElement(By.name("disabled"));

try {
element.click();
// A failing implementation will throw an exception
} catch (WebDriverException e) {
fail("The click should have been a no-op.\n" + Throwables.getStackTraceAsString(e));
}
}
}

0 comments on commit 6c7b4b4

Please sign in to comment.