1

動的に生成されたが最後の部分は同じままであるドロップダウンリスト ID で Selenium IDE の end-with コマンドを使用するにはどうすればよいですか?

私はもう試した

    select
    id=ends-with(@id, "_gridDropDownList")
    label=A

    select
    xpath=//name[ends-with(@id, "_gridDropDownList")]
    label=A

しかし、要素が見つからない、または xpath が無効であるというエラーが表示されます。

HTMLは次のとおりです。

    <td class="select-field district2-field blogLocationAndTopicFields">
    <label></label>
    <select
    id="ctl00_m_g_a5a2d9db_4beb_87c2_ce5e339b9858_ctl00_gridDropDownList"
    class=""
    name="ctl00$m$g_a5a2d9db_4beb_87c2_ce5e339b9858$ctl00$gridDropDownList"
    style="background-color: rgb(255, 255, 255);"></select>

助けてくれてありがとう...

4

2 に答える 2

0

html タグのすべての属性が動的である場合。

例えば:

select id="0ef13ca7-905d-42c7-8e9a-0a94a1d71ceeF_EditIOT-widget-select" class="freedomSelect notDojoDndHandle" aria-required="false" dojoattachevent="onchange:onChange, onfocus:onFocus, onblur:onBlur" dojoattachpoint="comboNode, containerNode, focusNode"

そしてselect[ends-with(@id,'EditIOT-widget-select')]機能していません。部分文字列の「含む」関数インスタントと関数で終わる関数を使用できます。

これを試して:

select[contains(@id, 'EditIOT-widget-select')]
于 2016-06-07T15:38:36.090 に答える
0

検証する Selenium IDE はありませんが、この部分が無効であると強く疑っています。

id=ends-with(@id, "_gridDropDownList")

functionends-with()はブール値を返しますidが、コードが比較している はおそらくブール値ではありません。substring-before()代わりに使用したいと思います:

id=substring-before(@id, "_gridDropDownList")
于 2015-03-08T02:57:18.253 に答える