angular - 量角器没有得到元素
问题描述
我有一个 Angular 6 应用程序,我正在尝试进行 e2e 测试。在这个测试中,我首先登录,然后尝试获取所有菜单项并单击它们,但是我什至无法获得menu
. 我的测试结果超时
应该可以通过菜单轻松导航 - 失败:脚本超时:11 秒内未收到结果(会话信息:chrome=70.0.3538.77)
和下面的第一个字符串(无论如何都没有多大意义)
来自:任务:Protractor.waitForAngular() - 定位器:Driver.schedule 处的 [object Object]
describe('Walking through', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should be at proper url', () => {
page.navigateTo();
page.logIn(
'test',
'password'
);
expect(
browser.wait(browser.ExpectedConditions.urlContains('dashboard'), 5000)
.catch(() => false)
).toBeTruthy();
});
// Not working
it('should easily navigate by menu', () => {
const menu = element(by.css('.menu'));
expect(menu).toBeTruthy();
const menuItems = element(menu).all(by.tagName('li'));
expect(menuItems).toBeTruthy();
menuItems.each(e => {
browser.sleep(500);
e.click();
expect(e).toBeTruthy();
});
});
});
解决方案
推荐阅读
- django - 如何针对具有 id 的对象创建对象
- java - 引起:java.lang.RuntimeException: Parcelable 遇到 IOException 读取 Serializable 对象
- ios - 是否有一个 swift 库可以让您自定义 JSON 中键的顺序?
- javascript - 如何从 curl -T --upload-data 选项中获取等效的数据格式在浏览器中使用 JavaScript?
- .net - OSX 上的 Cake 因“错误:程序集名称无效”而失败
- protractor - 量角器:元素不可交互
- python - 无法旋转 seaborn 图形下所有子图的 xticklabels
- javascript - Javascript binary animation infinite loop
- excel - 在 Sharepoint 中打开两个最后修改的文件
- azure - 在将 Redmine 部署为 PaaS 时需要帮助