Hi all,

I am writing a test case for a CSV-file uploading function, of a Jaggery
page. There is a browse button which allows to browse any file in the file
system. Once a file is selected and clicked the 'import' button, file get
uploads. Underneath what happens is, once the file is browsed and selected,
it gets assigned to a "*<input type ='file' name='dataFile'>* " element.
Follow is the html code.

                    *<div id="dataSource" class="row">*
*                        <div class="cell" > Data Source:</div>*
*                        <div class="cell">*
*                            <input type="text" id="datasetName"
name="datasetName" disabled/>*
*                            <input type="button" id="datasetOpen"
value="Browse" /> *
*                            <span id="datasetNameValidator"></span>*
*                        </div>*
*                        <input type="file" size="60" name="dataFile" id="*
*dataFile**"> *
*                    </div>*
*                    <div id="import" class="row">*
*                        <div class="cell"><input type="submit"
value="Import"></div> *
*                    </div>*

I've not been able trigger this using Selenium driver, since once the
'browse' button is clicked, the popup opens is a OS level window, thus
selenium driver cannot handle it. As a workaround, tried setting the file
path to the *<input type ='file' name='dataFile'> *html element, rather
than browsing the file. But again, Selenium driver is unable to set the
path to this element as it is an 'hidden' element.
(As the offline discussion, if I change the visibility of this file element
to 'visible', then the Selenium driver can set the file path to the
element, and the import function get triggered correctly.)

Any idea on how to trigger such a file uploading with Selenium, or any
workaround?

Much appreciate any help, as this has become a blocker for writing the rest
of the test cases.

Thanks
Supun

-- 
*Supun Sethunga*
Software Engineer
WSO2, Inc.
lean | enterprise | middleware
Mobile : +94 716546324
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to