Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Selenium by (6.1k points)

For single files it is working fine, this is the path.

"C:\\testdata\\testfile.txt"

But, syntax changes for multiple uploads and different browsers.

(

IE: 

"\"" + "C:\\Selenium\\TestData\\Flexy - BigFile1.txt"+"\"" +"\""+"C:\\Selenium\\TestData\\Flexy - BigFile2.txt" + "\""

CHROME: 

"C:\\Selenium\\TestData\\Flexy - BigFile1.txt"+"\n"+"C:\\Selenium\\TestData\\Flexy - BigFile2.txt".

Is there a common syntax available for all browsers?

1 Answer

0 votes
by (11.7k points)
edited by

Well, Selenium still does not support the uploading of multiple files. There is at least one workaround available: apparently create a form that contains as many input fields as you need. It is not the best solution, as it requires altering your code for selenium to work. However, as you have found out,  it does seem possible to trigger multiple file uploads in chrome and IE as well.

It is confirmed that the chrome "\n" trick works both locally and on Browserstack. I hope it will work for the problem you mentioned. 

You can take up this Selenium training course by Intellipaat to learn Selenium!

Browse Categories

...