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,425
  • 3
  • 23
  • 34
  • Maybe you have a website screenshot, or link ? – Dmitry Malinovsky Oct 16 '15 at 13:06
  • 1
    Possible duplicate of [How to Upload files using Selenium webdriver in Java](http://stackoverflow.com/questions/16896685/how-to-upload-files-using-selenium-webdriver-in-java) – JeffC Oct 16 '15 at 15:33
  • which browser are you using.. Had the same issue in FF but worked in chrome. Upgrading the FF fixed the issue. – Sighil Oct 16 '15 at 21:47

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
  • 943
  • 1
  • 7
  • 14