【发布时间】:2015-12-27 17:58:04
【问题描述】:
我有一个 Angular Web 应用程序,我想用 selenium 和 python 进行测试 html文件是这样的:
<div ng-repeat="item in items">
<div ng-repeat="address in addresses">
bla
</div>
<div ng-repeat="address in addresses">
dodo
</div>
</div>
<div ng-repeat="item in items">
<div ng-repeat="address in addresses">
foo
</div>
<div ng-repeat="address in addresses">
didi
</div>
</div>
使用 selenium 和 python,我想在项目中继器中查找项目中的所有元素,但前提是包含特定文本(例如 bla)
这意味着我想通过网页上显示的文本获取第一个转发器中的所有项目,而不是第二个转发器中的所有项目
我尝试过类似的方法
browser.find_element_by_xpath("//div[ng-repeat='item in items'] and (contains(text(), 'bla'))")
我的错误:
invalidSelectorException
【问题讨论】: