How to select many files using Windows file explorer with selenium webdriver

后端 未结 1 1582
花落未央
花落未央 2020-12-04 03:18

I am automating a UI test where selecting file to upload is involved, I was able to automate the file selection using this solution.

WebElement filepath=driv         


        
相关标签:
1条回答
  • 2020-12-04 03:46

    To upload multiple files you can construct the character string adding all the absolute path of the files seperated by \n as follows:

    WebElement filepath = driver.findElement(By.id("fileUploadId"));
    filepath.sendKeys("C:/TextFile1.txt \n C:/TextFile2.txt \n C:/TextFile3.txt");
    
    0 讨论(0)
提交回复
热议问题