Selenium IE Webdriver

时间:2015-02-21 15:59:47

标签: selenium

我正在研究Selenium java脚本,使用IE webdriver脚本我可以识别一个元素,但.click()不起作用。是否还有其他方法可以按ENTER键来对付该元素。点击此元素后,会出现一个下拉列表;我想从下拉列表中选择一个元素。 感谢帮助。

WebElement sve = driver.findElement(By.xpath("//table[@id='rptReportViewer_ctl05_ctl04_ctl00_Button']"));

if( sve.isDisplayed()){
    sve.click();
    System.out.println("element found");
} else {
    System.out.println("element not found");
}

下面是按钮ID;          font-size:10pt; border:1px solid rgb(51,102,153);背景颜色:     rgb(221,238,247); cursor:pointer;">

<table id="rptReportViewer_ctl05_ctl04_ctl00_Button" border="0"   

title="Export drop down menu">
<tbody>
<tr>
<td>
<a id="rptReportViewer_ctl05_ctl04_ctl00_ButtonLink" style="text-decoration:   
none; cursor: pointer;" href="javascript:void(0)" alt="Export drop down  
menu" title="Export drop down menu">

<img id="rptReportViewer_ctl05_ctl04_ctl00_ButtonImg" style="border-
style:None;height:16px;width:16px;border-width:0px;" alt="Export drop down  
menu" src="/Reserved.ReportViewerWebControl.axd?

OpType=Resource&Version=11.0.2802.16&Name=Microsoft.Reporting.WebForms.Icons.Export.gif"/>

<span style="width:5px;text-decoration:none;"/>
<img id="rptReportViewer_ctl05_ctl04_ctl00_ButtonImgDown" style="border- 
style:None;height:6px;width:7px;border-width:0px;margin-bottom:5px;"    
alt="Export drop down menu" src="/Reserved.ReportViewerWebControl.axd?  
 OpType=Resource&Version=11.0.2802.16&Name=Microsoft.Reporting.WebForms.Icons.ArrowDown.gif"/>
</a>
</td>
</tr>
</tbody>
</table>
</div>

0 个答案:

没有答案