Skip to content

Instantly share code, notes, and snippets.

@barancev
Last active December 20, 2015 19:29
Show Gist options
  • Save barancev/6183820 to your computer and use it in GitHub Desktop.
Save barancev/6183820 to your computer and use it in GitHub Desktop.
public static void main(String[] args) throws Exception {
WebDriver driver = new FirefoxDriver();
driver.get("http://jasny.github.io/bootstrap/javascript.html#fileupload");
JavascriptExecutor jse = (JavascriptExecutor) driver;
WebElement navbar = driver.findElement(By.cssSelector(".navbar "));
jse.executeScript("arguments[0].style.display='none'", navbar);
WebElement fileinput=driver.findElement(By.cssSelector("#fileupload .bs-docs-example input[type='file']"));
jse.executeScript("arguments[0].style.opacity=1", fileinput);
jse.executeScript("arguments[0].style['transform']='translate(0px, 0px) scale(1)'", fileinput);
System.out.println("fileinput.isDisplayedAgain(); " + fileinput.isDisplayed());
fileinput.click();
fileinput.sendKeys("C:\\temp\\test.py");
//driver.quit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment