package files;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class FileUpload {
WebDriver driver;
@Test
public void dragdrop() throws InterruptedException {
driver.get("https://www.sendspace.com/");
driver.manage().window().maximize();
Thread.sleep(2000);
driver.findElement(By.id("upload_file")).sendKeys("C:\\Users\\Ramesh\\Desktop\\blog.txt");
Thread.sleep(6000);
}
@BeforeClass
public void beforeClass() {
System.setProperty("webdriver.firefox.bin",
"C:\\Users\\Ramesh\\AppData\\Local\\Mozilla Firefox\\firefox.exe");
driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
}
@AfterClass
public void afterClass() {
driver.quit();
}
}
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class FileUpload {
WebDriver driver;
@Test
public void dragdrop() throws InterruptedException {
driver.get("https://www.sendspace.com/");
driver.manage().window().maximize();
Thread.sleep(2000);
driver.findElement(By.id("upload_file")).sendKeys("C:\\Users\\Ramesh\\Desktop\\blog.txt");
Thread.sleep(6000);
}
@BeforeClass
public void beforeClass() {
System.setProperty("webdriver.firefox.bin",
"C:\\Users\\Ramesh\\AppData\\Local\\Mozilla Firefox\\firefox.exe");
driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
}
@AfterClass
public void afterClass() {
driver.quit();
}
}
No comments:
Post a Comment