【发布时间】:2015-04-25 01:29:15
【问题描述】:
我有以下 HTML 代码 sn-p:
<div class="modal-body" style="max-height: 317px;">
<div class="radio">
<label>
<input type="radio" name="template" value="5">
<img src="/img/custom-icons/Monitor.png" style="height: 24px">
First descriptive title
<p class="text-muted">Some description text</p>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="template" value="37">
<img src="/img/custom-icons/Monitor.png" style="height: 24px">
Second descriptive title
<p class="text-muted"></p>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="template" value="46">
<img src="/img/custom-icons/Chart_Area_Up.png" style="height: 24px">
Third descriptive title
<p class="text-muted">Some text that describes an item.</p>
</label>
</div>
</div>
我想通过标签文本选择单选元素并单击它。我正在尝试做的事情:
$this->byXPath( "//label[text()='Second descriptive title']" )->click();
不幸的是,这不起作用。有任何想法吗?非常感谢您的帮助。
【问题讨论】:
标签: selenium xpath selenium-webdriver webdriver phpunit