0

I am using Selenium Driver in UBUNTU system.. Now i want to upload a file from my system..i am taking values from excel sheet..i am using dataprovider ..i ..given path in excel.. when i running the script it is not uploading the file..it is opening the window..but not selectin the file..Below is the code which i am trying.. and i also attaching the application code.. please help me..

@Test(dataProvider="ITRequest")
public void testMultipleITRequests(String category, String summary,         
String Description, String Filename1, String comment)
{
driver.findElement(By.id("new_it")).click();
Select se=new Select(driver.findElement(By.id("category")));
se.selectByVisibleText(category);
driver.findElement(bysummary).sendKeys(summary);
driver.findElement(byDescription).sendKeys(Description);
driver.findElement(By.id("Filename1")).click();
driver.findElement(By.id("Filename1")).sendKeys("Filename1");
driver.findElement(bycomment).sendKeys(comment);
driver.findElement(bybtnSubmit).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath("//html/body/div[1]/div[3]/div/div/div[3]/but     ton")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
sebenalern
  • 2,515
  • 3
  • 26
  • 36

1 Answers1

0

You are trying to upload the file in a wrong way. You have to use a sendkeys command for the file upload input tag.

driver.findElement(By. Id("Filename1") ) .sendKeys("/path/to/the/file")

debugger89
  • 2,108
  • 2
  • 14
  • 16