首页 > 解决方案 > “TestController”类型上不存在属性“openWindow”

问题描述

在我的测试中,我单击一个元素,然后打开新窗口。但我需要的是检查前一个窗口的请求。

我试图这样做:

https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/openwindow.html

import { Selector } from 'testcafe';

fixture `Example page`
    .page `http://www.example.com/`;

test('Open the TestCafe website', async t => {
    await t
        .openWindow('http://devexpress.github.io/testcafe')
        .openWindow('./documentation');

    const localWebsite = await t.openWindow('file://path/to/my/website');
});

但我收到了这个错误:

Property 'openWindow' does not exist on type 'TestController'.

标签: testingautomationautomated-testse2e-testingtestcafe

解决方案


您的测试用例在引入此 API 的最新版本的 TestCafe 1.9.0 中运行良好。

确保您使用的是正确的TestCafe 版本


推荐阅读