在表中使用xpath进行遍历时,Protractor将返回对象而不是值
Protractor is returning the object instead of the value when traversing using xpath in table
我是量角器的新手。我使用它来使用xpath从表中获取值。当我运行下面的代码时,它将返回对象,而不是td值
量角器代码:var result=元素(通过.xpath("//tr/td[@style='min-width:51px']"));console.log("++++++++++"+结果);
输出:+++++++++++++++++[对象对象]
HTML页面:
<div class="ng-scope" ng-include="'product/main/views/ABC.html'" ng-if="context.pat">
<section class="module module-pat product-banner ng-scope" ng-controller="product.main.PBS">
<figure class="pat-photo pull-left">
<table class="table-overview pull-left">
<tbody>
<tr>
<td style="min-width:225px">
<td class="ng-binding" style="min-width:51px">F</td>
<td class="ng-binding" style="min-width:61px">56</td>
<td class="ng-binding" style="min-width:130px">1958-03-13</td>
<td class="ng-binding" style="min-width:115px">Welby</td>
<td class="ng-binding" style="min-width:178px">United</td>
<td class="ng-binding" style="min-width:80px">Yes</td
<td>
<span class="label label-important ng-binding"/>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="pat-number ng-binding">123456789 </th>
<th class="ng-binding">Sex</th>
<th class="ng-binding">Age</th>
<th class="ng-binding">DOB</th>
<th class="ng-binding">PCP</th>
<th class="ng-binding">Country</th>
<th class="ng-binding">Insurance</th>
</tr>
</tfoot>
</table>
element(by.xpath("//tr/td[@style='min-width:51px']")).getText().then(function(result)
console.log("+++++++++++++++++"+ result);
});
相关文章:
- 节点导出返回一个空对象
- ES6构造函数返回基类的实例
- 监视函数从服务返回不起作用,但作用域函数起作用
- 控制台返回var不是't定义,但它是
- 从函数返回角度承诺
- Javascript返回值只在循环中返回一次
- 从控制器返回后Ajax启动事件激发
- CKFinder 3为所选文件返回错误的URL
- 如何在d3.js中返回路径的y坐标
- 如何从jquery函数返回变量
- Protractor:element.getText()返回一个对象,而不是String
- Protractor-分配给element.all.locator.count的变量返回NaN why
- 如何在Protractor中从父元素中返回子元素
- AngluarJS Protractor测试:函数应该返回一个promise
- Protractor-getText()返回一个数组而不是字符串
- 从Protractor页面对象返回一个对象
- Protractor-返回操作系统
- 当一切正常工作时,Protractor expect方法返回错误
- 在表中使用xpath进行遍历时,Protractor将返回对象而不是值
- Protractor sendKeys到Modal返回元素不可见