首页 > 解决方案 > 使用TestCafe登录后如何捕获角度页面?

问题描述

我可以使用 TestCafe 代码登录应用程序。但是登录后,它会重定向到 Angular 应用程序,我正在尝试捕获该页面中的元素。但每次我收到以下错误。ClientFunction 执行被页面卸载中断。如果您从 ClientFunction 代码触发页面导航,则可能会出现此问题

我试过 waitforAngular(); 到目前为止仍然没有运气。单击下一个按钮后,找不到选择器失败

import Page from './basic-page-model';
import { waitForAngular } from 'testcafe-angular-selectors';
// import { LoginPage } from './LoginPage';

const page = new Page();
fixture `My first fixture`
    .page `https://test.ci.ai.dynamics.com`
    .beforeEach(async t => {
        await t
            .typeText(page.nameInput, 'xxxxxx')
            .click(page.nextButton)
    });

test('My first test', async t => {
    await waitForAngular();    
    await t
        const header = await Selector('.d365shell-c-brand-title');
        let headerText = await header.innerText;
        await t
            .expect(headerText).eql('Dynamics 365');
});

标签: angularautomated-testse2e-testingweb-testingtestcafe

解决方案


如果没有详细的研究,很难确定问题的原因。请使用此表单和 TestCafe 团队的测试帐户在 TestCafe 存储库中创建单独的错误报告。这将帮助我们更快地找到解决方案。如果您无法在公共站点上共享凭据,请将您的报告发送至 support@devexpress.com。


推荐阅读