it('Check the row count', function () {
module.verifyTableTitle().getText().then(function (Title) {
expect(Title).toBe('ABC');
module.verifyexcel().isPresent().then(function (firstExcel) {
downloadex.verifyExcel('Excel1.xlsx');
**console.log("rowcount :"+rowObject1");**
}
this.verifyExcel = function (filename) {
let workbook = new Excel.Workbook();
browser.driver.wait(function () {
return files.existsSync(downloadDirectory + '\\' + filename);
}, 3000).then(function rowExcel() {
switch (filename) {
case 'Excel1.xlsx'':
let worksheet = workbook.getWorksheet("Excel1");
let rowObject1 = worksheet.rowCount;
console.log("rowcount :"+rowObject1);
});
return rowObject1;
});
break;
how to get the rowcount of excel sheet from verifyExcel function(console.log("rowcount:"+rowObject1)) to top function.
You can pass that variable as argument of top function, example:
const f1 = (arg) => { console.log(arg); } const f2 = () => { let rowcount = "test"; f1(rowcount); } f2(); f1();
declare a variable with var
or let
on top of your describe
block and simply use in any of it
blocks under the spec.
eg- please refer the sample-
import { browser } from 'protractor';
var yourVariable
describe('Info API: ', function () {
browser.ignoreSynchronization = true; // for non-angular websites
it('This is test ', function (done) {
your code;//use ur variable here
});
it('This is test1 ', function (done) {
your code;//use ur variable here
});
});
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.