forked from TalhaBinAshraf1/SeleniumTestingInternetHerokuApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUploadAFile.java
More file actions
26 lines (19 loc) · 782 Bytes
/
Copy pathUploadAFile.java
File metadata and controls
26 lines (19 loc) · 782 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
package allTests;
import org.testng.annotations.Test;
import utility.BaseTest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
public class UploadAFile extends BaseTest{
// @FindBy(xpath="//a[contains(text(),'File Upload')]")
// WebElement UploadFileLink;
@Test
public void uploadFileTest() {
System.out.println("Upload file test");
WebElement pageLink = driver.findElement(By.xpath("//a[contains(text(),'File Upload')]"));
pageLink.click();
WebElement uploadFileLink = driver.findElement(By.cssSelector("input#file-upload"));
uploadFileLink.sendKeys("C:\\My docs - Official\\Resume\\New\\PowerBI\\ToUpload.txt");
WebElement uploadSubmit = driver.findElement(By.cssSelector("input[type='submit']"));
uploadSubmit.click();
}
}