下面的代码:
<div class="row">
<div class=" col-md-4">
<p>Try entering some values for this widget</p>
<form class="form-inline ng-valid ng-dirty" role="form">
<p>This widget is outside of a niwa-big-number-model directive - it should get its values from the form </p>
<div class="big-number content widget green ng-isolate-scope" units="%" value="75" title="Humidity">
<div class="body">
<h1 class="ng-binding">Humidity </h1>
<div class="bigNum ng-binding">
</div>
</div>
</div>
<div class=" col-md-4">
<niwa-big-number-model class="ng-isolate-scope">
<div class="big-number-model"/>
<p class="ng-scope">This widget is fed from a niwa-big-number-model directive</p>
<div class="big-number content widget green ng-scope ng-isolate-scope" units="°C" value="15.5" title="Model Test">
<div class="body">
<h1 class="ng-binding">Model Test </h1>
<div class="bigNum ng-binding">
</div>
</div>
</niwa-big-number-model>
</div>
任务:
我想找到title = Model Test的CSS路径,因为在上面的代码中有多个具有相同名称的类,因此很难获得确切的CSS路径。
我尝试的是下面:
$I->see('Model Test','.bigNum.body:nth-child(2)');
仍然失败
谁能告诉我title =模型测试的确切CSS路径?
最佳答案
有很多方法可以做到这一点,这取决于页面上是否还有其他重复的标记。最简单的一种是:
.big-number-model h1 {}
另一个可能是:
.big-number-model .body .ng-binding {}
只要找到任何未重复的类,并在需要时添加其他嵌套的特异性即可。 Fiddle so you can play around with it.