Created
October 2, 2016 15:56
-
-
Save MaksymKrut/811dc4ad941ab76d879d00db7523e29a to your computer and use it in GitHub Desktop.
File upload with Selenium.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void uploadFile(WebElement uploadField, String name) throws InterruptedException, IOException { | |
File file = new File("src/main/resources/test.pdf"); | |
String absolutePath = file.getAbsolutePath(); | |
System.out.println("\n\nFile absolute path: " + absolutePath + "\n\n"); | |
uploadField.sendKeys(absolutePath); | |
Thread.sleep(100 * 1000); | |
System.out.println("\n\nFile with name: " + name + " has uploaded!\n\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment