【发布时间】:2014-06-09 14:31:58
【问题描述】:
我有一些在 chrome 中运行良好的测试,但是如果我切换到 phantomjs,我会遇到以下错误:
Unable to find element with css selector '.selected-recipients a'
我的测试是这样的:
it('should navigate when clicking edit', function() {
var editLink = element(by.css('.selected-recipients a')).element(by.css('.edit-preview'));
editLink.click();
expect(browser.getCurrentUrl()).toContain('#/recipients');
});
这在 chrome 上运行良好。问题是phantomjs。我发现一个帖子表明问题可能与窗口大小有关,但这并没有解决我的问题:
https://github.com/angular/protractor/issues/585
我也尝试使用 by.id 而不是 by.css,我也遇到了同样的问题。此文件中的所有其他测试工作正常,有些确实使用 by.css,因此 phantomjs 理解此定位器看起来不是问题。该元素似乎根本不在页面中。
有什么想法吗?谢谢
【问题讨论】:
标签: angularjs phantomjs protractor