1

I am trying to automate file upload on a Telerik RadAsyncUpload control on a page using Selenium. My environment is: MAC, chrome+FireFox
I have not been able to figure out how I can get the file selection dialog box opened from a RadAsyncUpload control. The control looks like this:
enter image description here

The control has this html structure:

<div id="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImage" class="RadAsyncUpload RadUpload RadUpload_Default" style="width:240px;">
        <input id="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImage_ClientState" name="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImage_ClientState" type="hidden" autocomplete="off">
    <ul class="ruInputs" id="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImageListContainer">
<li id="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagerow0"><span class="ruFileWrap ruStyled">
<input type="text" tabindex="-1" class="ruFakeInput radPreventDecorate" id="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagefakeInput0" size="22">
<label for="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagefakeInput0" style="display:none">label</label>
<input type="button" tabindex="-1" value="Upload screenshot/document" class="ruButton ruBrowse">
<input type="file" tabindex="0" class="ruFileInput" name="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagefile0" id="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagefile0" size="23">
<label for="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagefile0" style="display:none">label</label></span><div class="ruDropZone"><span>Drop files here</span></div></li></ul></div>

To open the file upload dialog box, I tried performing:

driver.findElement(By.id("ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagefile0")).click();

also

driver.findElement(By.id("ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImage")).click(); //Added event listener breakpoint on Mouse->Click and saw the parent <div> being highlighted.

None of these options opened up the file upload dialog box. I event tried clicking on the file input inside the control using javascript but that didn't work too.

Can anyone suggest if I am missing something / any other solution to trigger the file selection dialog?

Abhijeet Vaikar
  • 1,578
  • 4
  • 27
  • 50

0 Answers0