量角器 - 如何从 [object Object] 中提取数字

Protractor - How to extract a number from [object Object]

我正在编写一个测试来验证页面中的员工总数,它显示为 员工 (20)。在我的测试中,它作为 [object Object] 返回。我如何从中提取号码?

在您的页面文件中添加 getText() getEmpCount() 函数。

async getEmpCount() {
    this.groupsMenu.click();
    let title = await this.employeeTotal.getText(); 
    return title;
}

检查这个例子。我在同一个屏幕截图中同时拥有规范和页面文件。