我正在尝试选择并点击此<span>
<span class="el-icon 28-0"></span>
在以下层次结构中但无法执行此操作。
<div class="list-wrap ng-scope" ng-repeat="d in cols">
<div class="list-element selected" ng-click="a.cb(d.name, member.name)" ng-class="{selected: (selectValue === d.name || selectValue === member.name + ' ' + d.name)}">
<span class="el-icon 28-0"></span>
<!-- ngIf: !d.displayName --><span ng-if="!d.displayName" class="el-text ng-binding ng-scope">
28.0
</span><!-- end ngIf: !d.displayName -->
<!-- ngIf: d.displayName -->
</div>
</div>
<div class="list-wrap ng-scope" ng-repeat="d in cols">
<div class="list-element" ng-click="a.cb(d.name, member.name)" ng-class="{selected: (selectValue === d.name || selectValue === member.name + ' ' + d.name)}">
<span class="el-icon 27-0"></span>
<!-- ngIf: !d.displayName --><span ng-if="!d.displayName" class="el-text ng-binding ng-scope">
27.0
</span><!-- end ngIf: !d.displayName -->
<!-- ngIf: d.displayName -->
</div>
</div>
这是我正在引用的页面
https://docs.saucelabs.com/reference/platforms-configurator/?_ga=1.5883444.608313.1428365147#/
在&#34;浏览器&#34;部分,我试图选择FF 28.0
我已经尝试了
@driver.find_element(:css,"span.el-icon.28-0")
BUt it give
The given selector span.el-icon.28-0 is either invalid or does not result in a WebElement.
也试过这个
@driver.find_element(:css,"span.el-text.ng-binding.ng-scope").click
给出了
Element is not currently visible and so may not be interacted with
答案 0 :(得分:0)
Valid CSS classes cannot start with a number.
如果您无法更改班级名称,请尝试将选择器更改为span.el-icon[class*="28-0"]
注意:'contains'选择器[class*=...]
匹配给定属性包含给定值的任何元素。在这种情况下,任何具有包含'28 -0'的类属性的元素都将匹配。您也可以使用alt
,src
或href
等内容来匹配外部图片或链接。 Read more here 的