【问题标题】:Select drop down value using selenium RC使用 selenium RC 选择下拉值
【发布时间】:2014-07-03 05:59:00
【问题描述】:

有一个启用和禁用 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>

请建议如何使用 selenium RC 进行选择

【问题讨论】:

标签: selenium selenium-rc


【解决方案1】:

它不是select 元素,因此您无法与它进行交互。它可能使用 AJAX 使其看起来像一个选择菜单。

您需要在所有适当的元素上click()。我用已经好几年了,所以下面的代码可能需要调整。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-31
    • 1970-01-01
    • 2013-06-09
    相关资源
    最近更新 更多