如何在DOJO中导出以下路径?这是一个下拉列表。这个页面中有许多元素,但是尽管给出了正确的xpath,但是这样的一些元素并没有被识别出来。
选择下拉箭头的代码:
<div class=" dijitSelect dijitValidationTextBox dijitSelectError dijitValidationTextBoxError dijitError dijitSelectHover dijitValidationTextBoxHover dijitSelectErrorHover dijitValidationTextBoxErrorHover dijitErrorHover dijitHover" lang="en" widgetid="accountType" aria-expanded="false">
<table id="accountType" class="dijit dijitReset dijitInline dijitLeft dijitSelect dijitValidationTextBox dijitDownArrowButton" cellspacing="0" cellpadding="0" aria-haspopup="true" role="listbox" data-dojo-attach-point="_buttonNode,tableNode,focusNode" style="-moz-user-select: none;" tabindex="0" aria-required="true" aria-labelledby="addAccountRecordMain_accountType">
<tbody role="presentation">
<tr role="presentation">
<td class="dijitReset dijitStretch dijitButtonContents" role="presentation">
<td class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" role="presentation" data-dojo-attach-point="titleNode">
下拉箭头中的元素:
<div id="accountType_menu" class="dijit dijitMenu dijitReset dijitSelectMenu dijitValidationTextBoxMenu hdxSelectDropDownPopup accountTypePopup dijitMenuActive" style="overflow: hidden; top: 0px; visibility: visible; max-height: none; width: 331px; height: 270px;" role="presentation" widgetid="accountType_menu" tabindex="0">
<table class="dijitReset dijitMenuTable" cellspacing="0" data-dojo-attach-event="onkeypress:_onKeyPress" tabindex="0" role="listbox" style="width: 100%;">
<tbody class="dijitReset" data-dojo-attach-point="containerNode">
<tr id="dijit_MenuItem_43" class="dijitReset dijitMenuItem" tabindex="-1" role="option" data-dojo-attach-point="focusNode" aria-labelledby="dijit_MenuItem_43_text dijit_MenuItem_43_accel" style="-moz-user-select: none;" aria-disabled="false" widgetid="dijit_MenuItem_43">
<tr id="dijit_MenuItem_44" class="dijitReset dijitMenuItem dijitMenuItemHover dijitHover dijitMenuItemFocused dijitMenuItemHoverFocused dijitHoverFocused dijitFocused dijitMenuItemSelected" tabindex="0" role="option" data-dojo-attach-point="focusNode" aria-labelledby="dijit_MenuItem_44_text dijit_MenuItem_44_accel" style="-moz-user-select: none;" aria-disabled="false" widgetid="dijit_MenuItem_44">
<td class="dijitReset dijitMenuItemIconCell" role="presentation">
<td id="dijit_MenuItem_44_text" class="dijitReset dijitMenuItemLabel" data-dojo-attach-point="containerNode" colspan="2">FA-FA</td>
<td id="dijit_MenuItem_44_accel" class="dijitReset dijitMenuItemAccelKey" data-dojo-attach-point="accelKeyNode" style="display: none"/>
我用于选择此元素的各种组合: - &GT;
drive.findElement(By.xpath("//div[@id='accountType_dropdown']/div/div[1]/div/table/tbody/tr[2]/td[2]")).click();
drive.findElement(By.xpath("//td[@id='dijit_MenuItem_44_text'][contains(text(),'FA-FA')]")).click();
- &GT;
drive.findElement(By.xpath("//div/table[@id='accountType']/tbody/tr/td/div[2]")).click();
drive.findElement(By.xpath("//table[@id='accountType']/tbody/tr/td[2]")).click();
我收到的错误讯息:
线程中的异常&#34; main&#34; org.openqa.selenium.ElementNotVisibleException:无法单击元素(警告:服务器未提供任何堆栈跟踪信息)
我甚至尝试使用Webdriver等待和Javascript执行程序,但仍然无法正常工作。