无法进入Testcafe的for循环

问题描述 投票:0回答:0

我是 testcafe 的新手,目前正在为 Web 应用程序编写测试。该网页有一些单选框,由单选按钮和网络链接组成,默认情况下只选中其中一个。我正在尝试遍历所有单选框并识别所选单选框。但是,我注意到我的测试已成功执行,但似乎没有进入 for 循环。你能帮忙找出问题所在吗?以下是代码片段和结果。

Code result

test('Test1', async t => {
    await t
          .maximizeWindow()
        //test actions to reach the radio-boxes
        
          //identifying the selected radio-box
        console.log("Before Loop");
            for (let serviceCount = 0; serviceCount < serviceOptions.count; serviceCount++) {
         console.log("Inside Loop");
                if ((await serviceOptions.nth(serviceCount).contains('months or km')) && checkboxRadiobutton.nth(serviceCount).checked) {
                console.log("pass");
                } else {
                console.log("fail");
            }
           
      //Open the link provided in the radio-box
            await t.click(serviceDetailsLink.nth(serviceCount));
  }
});
loops for-loop testcafe
© www.soinside.com 2019 - 2024. All rights reserved.