Skip to content

Commit d48e75b

Browse files
committed
Adding a test for a click to a file input
1 parent d54b4ba commit d48e75b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

+22
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,22 @@
1717

1818
package org.openqa.selenium;
1919

20+
import static org.hamcrest.CoreMatchers.instanceOf;
2021
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertThat;
2123
import static org.junit.Assume.assumeFalse;
2224
import static org.openqa.selenium.Platform.ANDROID;
2325
import static org.openqa.selenium.WaitingConditions.elementTextToEqual;
2426
import static org.openqa.selenium.support.ui.ExpectedConditions.not;
2527
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
28+
import static org.openqa.selenium.testing.Driver.CHROME;
29+
import static org.openqa.selenium.testing.Driver.FIREFOX;
30+
import static org.openqa.selenium.testing.Driver.HTMLUNIT;
2631
import static org.openqa.selenium.testing.Driver.IE;
32+
import static org.openqa.selenium.testing.Driver.MARIONETTE;
2733
import static org.openqa.selenium.testing.Driver.PHANTOMJS;
2834
import static org.openqa.selenium.testing.Driver.SAFARI;
35+
import static org.openqa.selenium.testing.TestUtilities.catchThrowable;
2936

3037
import com.google.common.base.Charsets;
3138
import com.google.common.io.Files;
@@ -89,6 +96,21 @@ public void testCleanFileInput() throws Exception {
8996
assertEquals("", element.getAttribute("value"));
9097
}
9198

99+
@Test
100+
@Ignore(IE)
101+
@Ignore(MARIONETTE)
102+
@Ignore(FIREFOX)
103+
@Ignore(CHROME)
104+
@Ignore(PHANTOMJS)
105+
@Ignore(SAFARI)
106+
@Ignore(HTMLUNIT)
107+
public void testClickFileInput() throws Exception {
108+
driver.get(pages.uploadPage);
109+
WebElement element = driver.findElement(By.id("upload"));
110+
Throwable ex = catchThrowable(element::click);
111+
assertThat(ex, instanceOf(InvalidArgumentException.class));
112+
}
113+
92114
private File createTmpFile(String content) throws IOException {
93115
File f = File.createTempFile("webdriver", "tmp");
94116
f.deleteOnExit();

0 commit comments

Comments
 (0)