【发布时间】:2013-06-19 13:03:53
【问题描述】:
我正在尝试编写一个测试来检查元素是否具有类:
element('#header-menu .menu-component-item a').query(function(els, done) {
var el = els.eq(4);
el.click();
sleep(.25);
expect(browser().location().path()).toBe(el.attr('href'));
expect(el.attr('class')).toContain('selected');
done();
});
问题是我不断收到错误TypeError: Cannot read property 'indexOf' of undefined。我希望el.attr('class') 成为未来,但我不确定为什么不是。有没有其他方法可以解决这个问题?
【问题讨论】:
标签: angularjs angular-scenario