【发布时间】:2017-10-03 14:55:44
【问题描述】:
我在使用 Angular 构建的应用程序的一页上使用常规 selenium webdriver 时遇到严重问题。我在 pom.xml 中添加了 ngwebdriver 的依赖项,到目前为止我已经解决了一些问题。只有下拉,我还没有弄清楚如何做到这一点。这是我正在谈论的下拉菜单:
<d3-data-list _nghost-c8="" ng-reflect-data-source="[object Object]" ng-
reflect-html-id="documents_glossary_entityPicke" ng-reflect-allow-blank-
option="true" ng-reflect-blank-option-text="All entities" ng-reflect-default-
caption="Choose an entity"><div _ngcontent-c8="" class="dropdown d3-data-
list" id="documents_glossary_entityPicker">
<button _ngcontent-c8="" aria-expanded="true" aria-haspopup="true" class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button" id="documents_glossary_entityPicker_button">
All entities
<span _ngcontent-c8="" class="caret"
id="documents_glossary_entityPicker_caret"></span>
</button>
<ul _ngcontent-c8="" aria-labelledby="dropdownMenu1" class="dropdown-menu"
ng-reflect-infinite-scroll-handle-in-progress="false"
id="documents_glossary_entityPicker_dropdown">
<!--bindings={
"ng-reflect-ng-if": "true"
}--><li _ngcontent-c8="">
<a _ngcontent-c8=""
id="documents_glossary_entityPicker_blank_option">All entities</a>
</li>
那么下拉菜单中的选项是这样的:
</li><li _ngcontent-c8="">
<a _ngcontent-c8="" id="documents_glossary_entityPicker_option_2">Entity three</a>
</li>
问题是我的下拉列表中元素的顺序没有保持,因为如果在另一个页面上编辑元素(实体),那么它将位于列表的底部。所以我永远无法真正知道我的元素在下拉列表中的确切位置。
有没有像browser.findElement(ByAngular.buttonText("text")) 这样的东西可以用于我的情况?谢谢。
【问题讨论】:
标签: java angularjs selenium protractor