如何在使用Ext JS

时间:2017-09-23 18:51:28

标签: c# selenium-webdriver

<a id="createDetailItem" class="x-btn x-unselectable x-btn-toolbar x-box-item x-toolbar-item x-btn-default-toolbar-small x-icon-text-left x-btn-icon-text-left x-btn-default-toolbar-small-icon-text-left" hidefocus="on" unselectable="on" tabindex="0" style="right: auto; left: 772px; top: 0px; margin: 0px;">
<span id="createDetailItem-btnWrap" class="x-btn-wrap" role="presentation" unselectable="on">
<span id="createDetailItem-btnEl" class="x-btn-button" role="presentation">
<span id="createDetailItem-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on">New Expense Item</span>
<span id="createDetailItem-btnIconEl" class="x-btn-icon-el icon-plus " role="presentation" unselectable="on" style=""/>
</span>
</span>
</a>

尝试

By.XPath(&#34; // [包含(@class,&#39; createDetailItem&#39;)并包含(@class,&#39; x-btn-wrap&#39;)]& #34; By.CssSelector(&#34; a [class =&#39; x-btn-inner x-btn-inner-center&#39;]&#34;

By.XPath(&#34; // [包含(@class,&#39; x-btn-wrap&#39;)并包含(@class,&#39; x-btn-inner x- BTN-内中心&#39)]&#34; 还有更多。

您可以帮助选择新费用项目按钮。感谢

1 个答案:

答案 0 :(得分:0)

为什么在id为

时使用定位器xpath
By.Id("createDetailItem-btnInnerEl")