1

Need to upload the .mp3 file Using page object model code:

@FindBy(xpath="//*[@class='iconmoon icon-upload-square f24 v-middle']/..")
    WebElement choosefile;
public void selectfile() throws InterruptedException {                                                                                                                                  
        log.info("element appearing ");
        Thread.sleep(5000);


        WebDriverWait wait1 = new WebDriverWait(driver, 10);
        WebElement element1 = wait1.until(ExpectedConditions.elementToBeClickable(choosefile));
        //element1.click();
        //element1.sendKeys(System.getProperty("user.dir")+"/extras/song2.mp3");   (way 1 passed path)
        element1.sendKeys("C:\\Users\\DELL\\Desktop\\SS_Tops\\LabZ\\songs\\dfg.mp3"); (way 2)
        }
}

HTML :

<div class="ButtonPanel uploadFileBox-btn">
  <div class="upload-file">
    <i class="iconmoon icon-upload-square f24 v-middle"></i>
    Browse files
    <input multiple="" type="file" id="browse-file">
  </div>
</div>

When I am trying to click the on this button the I can see the click & the window opened, but at the same time trying to pass the file it throws the error of:

org.openqa.selenium.ElementNotInteractableException: element not interactable"

frianH
  • 7,295
  • 6
  • 20
  • 45
  • 1
    it's because you are sending keys to wrong element. you should pass it to element with xpath "//input[@type='file']" . And you don't need to click the button since sendKeys with filepath had done the job – Millie Anne Volante Nov 11 '20 at 09:21

0 Answers0