Javascript 使用Selenium WebDriver在RadAsyncUpload控件上触发文件上载对话框

Javascript 使用Selenium WebDriver在RadAsyncUpload控件上触发文件上载对话框,javascript,selenium,selenium-webdriver,asyncfileupload,radupload,Javascript,Selenium,Selenium Webdriver,Asyncfileupload,Radupload,我正在尝试使用Selenium在Telerik RadAsyncUpload控件上自动上传文件。我的环境是:MAC,chrome+FireFox 我不知道如何从RadAsyncUpload控件打开文件选择对话框。控件如下所示: 控件具有以下html结构: <div id="ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImage" class="RadAsyncUpload RadUpload RadUpload_Default" style="w

我正在尝试使用Selenium在Telerik RadAsyncUpload控件上自动上传文件。我的环境是:MAC,chrome+FireFox
我不知道如何从RadAsyncUpload控件打开文件选择对话框。控件如下所示:

控件具有以下html结构:

<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>

driver.findElement(By.id(“ctl00\u cphBody\u wzAddItem\u rptItems\u ctl00\u rdauImage”)。单击()//在鼠标->单击时添加了事件侦听器断点,并看到父级被高亮显示。

这些选项都没有打开“文件上载”对话框。我尝试使用javascript单击控件内的文件输入,但也不起作用

有人能建议我是否遗漏了触发文件选择对话框的内容/任何其他解决方案吗?

您可以通过.partialLinkText(“上载”)尝试
吗?html中没有锚定标记可以使用partialLinkText()查找它,我不确定:(因为Telerik RadAsyncUpload
听起来像Silverlight控件,不确定Selenium是否能够处理该问题。您可以尝试查看此答案。)-
driver.findElement(By.id("ctl00_cphBody_wzAddItem_rptItems_ctl00_rdauImagefile0")).click();
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.