How to upload files using selenium webdriver


package selenium_examples;


import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;


public class Sample {

public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.files.com/");
driver.manage().window().maximize();
WebElement uploadElement = driver.findElement(By.name("file_0"));
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
uploadElement.sendKeys("E:\\index.jpg");

 
}
}


 
upload file in selenium webdriver


No comments:

Related Posts Plugin for WordPress, Blogger...