Note that there are some explanatory texts on larger screens.

plurals
  1. POUploading File Using Selenium
    primarykey
    data
    text
    <p>Am new to selenium.My requirement is to automate uploading of a csv file using a browse button.The issue am facing is i have 2 forms with two browse buttons,with same name and same value.So i have to click browse button based on form(form names are different).Below is my sample code</p> <p>Script to click browse button:</p> <pre><code>#include &lt;IE.au3&gt; ; Internet Explorer is partly integrated in shell.application $oShell = ObjCreate("shell.application") ; Get the Windows Shell Object $oShellWindows=$oShell.windows ; Get the collection of open shell Windows $MyIExplorer="" for $Window in $oShellWindows ; Count all existing shell windows ; Note: Internet Explorer appends a slash to the URL in it's window name if StringInStr($Window.LocationURL,"http://") then $MyIExplorer=$Window exitloop endif next $oForm = _IEGetObjByName ($MyIExplorer, "document.forms['UploadForm'].elements['browsebutton']") _IEAction($oForm, "click") </code></pre> <p>Below is my script to upload csv file</p> <pre><code>WinActivate("File Upload"); Local $file ="C:\Work\selenium\abc.csv" ControlSetText("Choose file", "", "Edit1", $file ) ControlClick("File Upload", "", "Button2") </code></pre> <p>Am calling the code as below in my java class:</p> <pre><code>Process proc = Runtime.getRuntime().exec("C:\\bowsebutton.exe"); Process proc1 = Runtime.getRuntime().exec("C:\\test3.exe"); </code></pre> <p>When i run seleinum Am not able to click the browse button at all.But if i manually click the browse button the csv gets uploaded automatically and file gets submmitted.</p> <p>Am not able to figure out why the browse button is not being clicked.Any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload