我想知道如何识别并点击底部列出的按钮。
<div class="media-body feed-item">
<div class="media-main" ng-class="{'no-avatar' : feed.type === 'Newsfeed' || feed.type === 'ProductItem' || feed.type === 'PollResult' || feed.type === 'GoalKeyResultUpdate'}">
<div class="meta meta-actions mar-bot10 has-icon" ng-class="{'has-icon': feed.type !== 'Newsfeed' && feed.type !== 'ProductItem' && feed.type !== 'PollResult'}">
<ul class="inline clearfix">
<li ng-if="!feed.MeCongrated && userData.memberActive" class="ng-scope">
<button type="button" class="btn-meta ng-scope" ng-click="congrats(feed)" translate="profile.partials.rec.fee.lik"> Like</button></li>
答案 0 :(得分:0)
element(by.ButtonText("Like")).click()
或
element(by.partialButtonText("Like")).click()
如果班级是唯一的:
element(by.className("btn-meta ng-scope")).click()
通过css:
element(by.css("btn-meta.ng-scope")).click()
通过css选择的另一种方式:
element(by.css("[ng-click='congrats(feed)']")).click()
按xpath选择:
element(by.xpath(".//button[@ng-click='congrats(feed)']")).click()
或者您可以通过ng-click创建自定义选择器。