是否有可能发现量角器错误?我尝试过:
let MagicBtn = element(by.css('.submitBtn'));
expect(() => {(MagicBtn.click();}).toThrowError("Failed: No element found using locator: By(css selector, a[id=link33])");
或不同的案例如:
expect(MagicBtn.click()).toThrowError("Failed: No element found using locator: By(css selector, a[id=link33])");
或创建一个新函数并通过throwerror捕获它:
var foo = function() {
MagicBtn.click();
};
let exception1 = new TypeError('Failed: No element found using locator: By(css selector, a[id=link33])')
expect(foo).toThrowError(exception1);
但是toThrowError捕获了不是由量角器引起的错误(当然这是可以理解的) - 我只是觉得它是否可以解决