【问题标题】:Using JS dynamic variables in Fixture在 Fixture 中使用 JS 动态变量
【发布时间】:2019-07-07 01:32:51
【问题描述】:

我是第一次使用开源 TestCafe。我有 3 个 JS 动态变量需要在夹具中使用,但由于变量名称更改,我不知道如何输入它们。

//I have this code, the 3 variables below are dynamic and I do not know how to         
//define them for the test to work 
import { Selector } from 'testcafe';

fixture `Getting Started`;  
    .page `http://mypage/example`;

test('My First Test', async t => {
    await t
        .typeText('#_19ea794cf2c5da', 'John.Smith@mail.com') //e-mail
        .typeText('#_1f5041dd561eb6', 'John Smith') //name
        .typeText('#_1ba6e017739c70', '5515675800') //telephone
});

连接已执行,但在第一个动态变量中标记错误

【问题讨论】:

    标签: automated-tests open-source e2e-testing web-testing testcafe


    【解决方案1】:

    您需要更改定位元素的方式。有几种方法可以定位具有动态生成的 ID 的元素:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多