Adding a test for a click to a file input
package org.openqa.selenium;
+import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeFalse;
import static org.openqa.selenium.Platform.ANDROID;
import static org.openqa.selenium.WaitingConditions.elementTextToEqual;
import static org.openqa.selenium.support.ui.ExpectedConditions.not;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
+import static org.openqa.selenium.testing.Driver.CHROME;
+import static org.openqa.selenium.testing.Driver.FIREFOX;
+import static org.openqa.selenium.testing.Driver.HTMLUNIT;
import static org.openqa.selenium.testing.Driver.IE;
+import static org.openqa.selenium.testing.Driver.MARIONETTE;
import static org.openqa.selenium.testing.Driver.PHANTOMJS;
import static org.openqa.selenium.testing.Driver.SAFARI;
+import static org.openqa.selenium.testing.TestUtilities.catchThrowable;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
@@ -89,6 +96,21 @@ public void testCleanFileInput() throws Exception {
assertEquals("", element.getAttribute("value"));
}
+ @Test
+ @Ignore(IE)
+ @Ignore(MARIONETTE)
+ @Ignore(FIREFOX)
+ @Ignore(CHROME)
+ @Ignore(PHANTOMJS)
+ @Ignore(SAFARI)
+ @Ignore(HTMLUNIT)
+ public void testClickFileInput() throws Exception {
+ driver.get(pages.uploadPage);
+ WebElement element = driver.findElement(By.id("upload"));
+ Throwable ex = catchThrowable(element::click);
+ assertThat(ex, instanceOf(InvalidArgumentException.class));
+ }
+
private File createTmpFile(String content) throws IOException {
File f = File.createTempFile("webdriver", "tmp");
f.deleteOnExit();
