Below is my selenium code
selenium.type("document.forms['UploadForm'].elements['browse']",file.getAbsolutePath());
selenium.click("document.forms['UploadForm'].elements['submit']");
I have multiple forms,which has multiple browse button with property as “broswe” an d multiple submit buttons with property as submit.Since am uploading file by using the form name where i need to upload the file,i.e “UploadForm” and need to submit in the same form.
But the problem am facing is with out uploading the file,selenium is hitting submit button.
Below is autoit script
WinWaitActive("Choose File")
Send("C:\Work\selenium\PMG_SPRINT_AUTOMATION\pmg_automation\block_PTN.csv")
Send("{ENTER}")
How do i adjust this code in my selenium class as there are multiple selenium buttons
try {
String[] commands = new String[]{};
commands = new String[]{"C:\\Program Files\\AutoIt3\\attachDocScript.exe"}; //location of the autoit executable
Runtime.getRuntime().exec(commands);
}
catch (IOException e) {}
You can go with Autoit.There you can write script for uploading and downloading documents very easily and then you can call those scripts in your selenium code wherever needed.