遍历每一行以获取列文本 [英] Traverse through each row for a column text
本文介绍了遍历每一行以获取列文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网格
html代码位于 pastebin.com/GBP3AZNQ
我想验证是否存在"test123".我想遍历列主impactname的每一行,并查找文本test123.
I want to verify whether "test123" is present. I want to traverse through each row of column master obligationname and look for the text test123.
有人可以指导我该怎么做吗?
Can anyone guide me how to do this?
推荐答案
您可以采用parent class
并实现以下目标:
You can take the parent class
and achieve this as follows:
element.all(by.xpath("//div[@class='ui-grid-cell-contents ng-scope ng-binding']")).getText().then(function (msg)
{
console.log("Grid contains" + msg);
expect(msg).toContain("test123");
}
如果Master_obligation名称为test_876
然后
If suppose the Master_obligation name is test_876
Then
var master_obligation_name= "test_876" ;
假设您将义务名称"填写为:
Suppose you are filling obligation_name as:
element(by.xpath("path to master_obligation text field")).sendKeys(master_obligation_name);
创建行后,验证新添加的行:
After creation of the row, validating the newly added row:
var row_check = element(by.xpath("//div[contains(text(),'test_876')]"));
if(row_check.isPresent())
{
row_check.getText().then(function (msg) {
console.log("Grid contains" + msg);
});
}
学习愉快. :-)
这篇关于遍历每一行以获取列文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文