I need to extract the value from a particular table cell (eg Row 3 + Column 5). below is the snippet from my current script which returns the value from the top row, but It can not go to a cell that is in the rows below the top row. The code was developed following the link
it ('ESY_27 : Edit Button Click', function(){
// get rows
var rows = tableData_Dashboard.all(by.tagName("tr"));
// get cell values
var cells = rows.all(by.tagName("td"));
var Student_ID = cells.get(0).getText().then(function(SID){
console.log(SID);
});
var School_Name = cells.get(1).getText().then(function(SN){
console.log(SN)
});
var StudentName = cells.get(2).getText().then(function(StN){
console.log(StN);
});
var GradeLevel = cells.get(3).getText().then(function(GL){
console.log(GL)
});
});
How can I access a particular table cell (like Row 3 & Column 4) and extract data from it using protractor?
Note: think about using async / await since it will help when the control flow is deprecated (in the next version of Protractor). The following snippet uses async / await and only gets the text from row 3 and column 4.
it ('Get row 3, get col 4', async () => {
// get row 3
const row = tableData_Dashboard.all(by.tagName("tr")).get(2);
// get cell 4 (grade level)
const cell = row.all(by.tagName("td")).get(3);
console.log(await cell.getText());
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.