-2

While automating the upload file feature in selenium using Java, the control is not going to the file according to the file path I have provided. Why is the control not reaching to the file properly?

My code

uploadWebElement.click(); 
(new Actions(DriverConfiguration.driver())).sendKeys(new CharSequence[]{filePath, Keys.ENTER}).perform();

Error

The problem is when I clicked for browse, it opens the desktop folder and the one where I saved the file, is not reaching through this.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
PK1609
  • 1
  • 4

1 Answers1

0

if upload popup is windows/OS one then selenium can't work, if the popup up is related to browser then sendkeys will work to upload the file.

Point is actions bit not working in present gecko if you are using firefox.

For handling windows popup, you can try Robot class in java or AutoIT tool etc..

murali selenium
  • 3,847
  • 2
  • 11
  • 20