簡體   English   中英

使用硒RC選擇下拉值

[英]Select drop down value using selenium RC

有一個下拉菜單,其中啟用和禁用了2個值,但是該字段具有type = button。 我不確定如何在此下拉列表中選擇值。

以下是該元素的html代碼

<button id="loggingTargetStatus" class="dijitReset dijitStretch dijitButtonContents dijitDownArrowButton" waistate="haspopup-true,labelledby-loggingTargetStatus_label" wairole="button" dojoattachpoint="focusNode,titleNode,_arrowWrapperNode" value="" type="button" role="button" aria-haspopup="true" aria-labelledby="loggingTargetStatus_label" tabindex="0" style="-moz-user-select: none;">
<span class="dijitReset dijitInline cpmIconStateEnable" dojoattachpoint="iconNode"></span>
<span id="loggingTargetStatus_label" class="dijitReset dijitInline dijitButtonText" dojoattachpoint="containerNode,_popupStateNode">Enabled</span>
<span class="dijitReset dijitInline dijitArrowButtonInner"> </span>
<span class="dijitReset dijitInline dijitArrowButtonChar">▼</span>
</button>

請建議如何選擇使用硒RC

它不是一個select元素,因此您不能與之交互。 它可能使用AJAX使其看起來像選擇菜單。

您將需要在所有適當的元素上click() 自從我使用已經好幾年了,因此以下代碼可能需要進行調整。

selenium.click("loggingTargetStatus");    // to enable the menu
selenium.click(your_field);    // you will have to find the correct locator

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM