I have developed one selenium webdriver script in JMeter. My script is running well but it stuck at one scenario. I am not able to upload/file/files in Dropzone from my system. I tried below code but it is not working. What is right way to do that with Java/Javascript-Selenium in JMeter.
var chooseFile = WDS.browser.findElement(org.openqa.selenium.By.id("formImportFilesDropZone"));
WDS.browser.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS);
chooseFile.sendKeys("C:\Users\RIDE.txt");
CodePudding user response:
I think you need to escape the back slashes with another instance of backslash like:
chooseFile.sendKeys("C:\\Users\\RIDE.txt");
or just use forward slashes:
chooseFile.sendKeys("C:/Users/RIDE.txt");
You may also need to specify fully qualified class name for the TimeUnit like:
WDS.browser.manage().timeouts().implicitlyWait(1000, java.util.concurrent.TimeUnit.SECONDS);
More information:
Also get used to look at jmeter.log file, normally it contains if not the reason of failure or misbehaviour but at least a clue.
CodePudding user response:
Once window explorer is opened, you can use send Keys method to send the path of the file and then again use send Keys method to send Enter key.

