且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

遍历每一行以获取列文本

更新时间:2023-02-05 10:38:22

您可以采用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);
  });
 }

学习愉快. :-)