Hi Awanthika, Thanks for the link. But in my case, the hidden field is a <input type=file> element, of which i want to change the 'value' (set the file path). This is not possible through JavaScript for security reasons [1] , [2]. Workaround is to change the 'visibility' through javaScript which is possible, and then trigger it using selenium. But this again brings the concern on changing the application by a test case, which Saneth has mentioned above.
[1] http://stackoverflow.com/questions/20537696/remember-and-repopulate-file-input/20537822#20537822 [2] http://stackoverflow.com/questions/1696877/how-to-set-a-value-to-a-file-input-in-html Thanks, Supun On Mon, Dec 15, 2014 at 8:39 AM, Awanthika Senarath <[email protected]> wrote: > > Hi Supun, > > This post [1] discusses few suggestions on triggering hidden div elements. > > [1] > http://stackoverflow.com/questions/12040615/selenium-webdriver-clicking-on-hidden-element > > thanks and regards > > On Mon, Dec 15, 2014 at 7:35 AM, Supun Sethunga <[email protected]> wrote: > >> Hi Krishantha, >> >> Test cases hasn't been pushed to any remote repo yet. Will share the >> local copy of the pack, which includes the test cases, with you. >> >> Regards, >> Supun >> >> On Sat, Dec 13, 2014 at 10:28 AM, Krishantha Samaraweera < >> [email protected]> wrote: >> >>> Hi Supun, >>> >>> Can you share a pack to reproduce this behaviour. Please mention the >>> steps to follow. >>> >>> Thanks, >>> Krishantha. >>> >>> >>> >>> On Sat, Dec 13, 2014 at 8:33 AM, Supun Sethunga <[email protected]> wrote: >>>> >>>> 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 >>>> >>> >>> >>> -- >>> Krishantha Samaraweera >>> Senior Technical Lead - Test Automation >>> Mobile: +94 77 7759918 >>> WSO2, Inc.; http://wso2.com/ >>> lean . enterprise . middlewear. >>> >> >> >> -- >> *Supun Sethunga* >> Software Engineer >> WSO2, Inc. >> lean | enterprise | middleware >> Mobile : +94 716546324 >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > -- > Awanthika Senarath > Software Engineer, WSO2 Inc. > Mobile: +94717681791 > > > -- *Supun Sethunga* Software Engineer WSO2, Inc. lean | enterprise | middleware Mobile : +94 716546324
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
