我正在尝试访问table data
使用Selenium的文本,然后检查它是否等于给定的文本。
我面临的问题是Expected result gets converted to Array with [] brackets
。
如何将其转换为基本字符串?哪些代码更改将帮助我实现这一目标?
下面是我的代码
const resultList = element.all(by.css('table tr:nth-of-type(9) [colspan]'));
expect(resultList.getText()).toEqual("This is data");
输出-错误
Expected [ 'This is data' ] to equal 'This is data'.
试图达到(Without Brackets []
)
Expected 'This is data' to equal 'This is data'.
您可以将代码更改为此-
expect(element(by.css('table tr:nth-of-type(9) [colspan]')).getText()).toEqual("This is test data.");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句