I am trying to automate a file upload scenario in a client web application. The code of the entire file upload form looks like this
<td valign="top"> <iframe id="batchLoad:inputFile:uploadFrame" class="iceInpFile" width="600px" scrolling="no" height="30px" frameborder="0" title="Input File Frame" style="border-collapse:collapse; border-spacing:0px; padding:0px;" src="/hip-webapp/block/resource/LTExMzg4MjQzMTY=/" name="batchLoad:inputFile:uploadFrame" marginwidth="0" marginheight="0" allowtransparency="true"> <html style="overflow:hidden;"> <head> <body style="background-color:transparent; overflow:hidden"> <form id="fileUploadForm" enctype="multipart/form-data" action="/hip-webap/uploadHtml" method="post"> <input type="hidden" value="batchLoad:inputFile" name="ice.component"> <input type="hidden" value="3" name="ice.view"> <input class="iceInpFileTxt" type="file" size="35" name="upload"> <input class="iceInpFileBtn" type="submit" value="Upload"> </form> </body> </html> </iframe> <br> <span id="batchLoad:j_id537"></span> </td>
I tried with the conventional File upload method but that did not work. I am not much familiar with Javascript hence I think I am doing some syntax error. What I tried is:
String ew = (String)js.executeScript("document.getElementByXPath('//form[@id='fileUploadForm']/input[3]')"); String j = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';"; js.executeScript(j, ew);
((JavascriptExecutor)driver).executeScript("document.getElementByClassName(iceInpFileTxt).style.visibility = 'visible';"); ((JavascriptExecutor)driver).executeScript("document.getElementByClassName('iceInpFileTxt').value
= 'D:\\AD\\Prac\\Prac\\002 EditPrac Add Person
Error.xml-revHEAD.svn000.tmp.xml'");
Please advice. What I intend to do is unhide the file upload element and sendkeys the absoulute path of the xml file.--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver.
For more options, visit https://groups.google.com/groups/opt_out.