按ajx属性查找元素

时间:2017-02-10 16:24:30

标签: c# selenium automated-tests

如何通过ajxnameid使用selenium找到这个?一般来说,ajx属性?

此代码是较大部分的一部分,而ajxnameid是其唯一的唯一部分。

driver.FindElementBy ??

<INPUT tabIndex=0 title="Champ obligatoire" class=class_studio_field_4 style="HEIGHT: 18px; WIDTH: 216px; LEFT: 150px; Z-INDEX: 1174; TOP: 50px; BACKGROUND-COLOR: #ffafaf" unselectable="off" ajxwidth="216" ajxheight="20" ajxtopcontainer="id_controls_area" ajxdesign="false" ajxname="RT_FUND1_1_4" ajxnameid="###RT_FUND1_1_4_54" ajxleft="150" ajxtop="50" ajxhorzalign="left" ajxvertalign="top" ajxhidden="false" ajxevents="undefined" ajxmenuitems="undefined" ajxdynamicmenuitems="undefined" ajxactionrules="undefined" is_add_element="undefined" appended_from="undefined" ajxuniquename="12|RT_FUND1_1_4" ajxoverride="undefined" ajxmasterpanel="false" ajxpath="FUND1" ajxfield="FUND1" ajxstyle="4" ajxexclusive="true" ajxdisabled="false" ajxtabindex="0" ajxtitle="undefined" ajxnotnull="true" ajxhtmlclass="undefined" ajxinnerhelpcaption="undefined" ajxheightlost="2" ajxforcedisabled="false" ajxcheckingrules="undefined" _disabled="false" ajxstarttext ajxsearchdone="false" ajxminchar="undefined" ajxautocompleteonfocus="undefined" ajxautocompleteifemptyvalue="undefined" ajxevent="undefined" ajxloaddata="undefined" ajxnocache="undefined" ajxseparators="undefined" ajxaddparam="undefined" ajxcall_condition="undefined" ajxinlinestyle="undefined" ajxaddparamexpr="undefined" ajxcontrolclass="CTRL_AUTOCOMPLETE" ajxnull="false" ajxcheckable="true" ajxbackcolor="#FFE0E1" ajxerror="Champ obligatoire">

1 个答案:

答案 0 :(得分:2)

driver.FindElement(By.CssSelector("input[ajxnameid='###RT_FUND1_1_4_54']"));

我的偏好是不使用XPath。甚至我的开发人员都讨厌它。