Below is the AUTO It Script for Mutiple Files
$vVariable = """C:\Users\NEERAJ\Desktop\Manage_Plugins.jpg"" ""C:\Users\NEERAJ\Desktop\Manage_Plugins1.jpg"""
ControlFocus("File Upload","","Edit1")
Sleep(2000)
Sleep(2000)
ControlSetText("File Upload", "", "Edit1" ,$vVariable)
Sleep(2000)
Note:Here we are using double quotes , because when we upload multiple files the files are seperated with double quotes.
Example: " "filename1" "filename2" "
Refer below Screenshot
Refer Below Working Script
package mypackage;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class myclass {
public static void main(String[] args) throws IOException, InterruptedException {
WebDriver driver = new FirefoxDriver();
String baseUrl = "https://davidwalsh.name/demo/multiple-file-upload.php";
driver.get(baseUrl);
driver.findElement(By.xpath(".//*[@id='filesToUpload']")).click();
Thread.sleep(4000);
Runtime.getRuntime().exec("C:\\Users\\NEERAJ\\Desktop\\NewUpload.exe");
}
}
No comments:
Post a Comment