-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileUpload.java
More file actions
31 lines (21 loc) · 884 Bytes
/
FileUpload.java
File metadata and controls
31 lines (21 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package automation;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FileUpload {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver", "D:\\Quastech\\Software\\geckodriver-v0.30.0-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://demo.guru99.com/test/upload/");
driver.manage().window().maximize();
WebElement upload = driver.findElement(By.id("uploadfile_0"));
upload.sendKeys("D:\\Quastech\\testdata.xlsx");
Thread.sleep(2000);
driver.findElement(By.id("terms")).click();
driver.findElement(By.id("submitbutton")).click();
Thread.sleep(3000);
driver.close();
}
}