测试咖啡馆选择器找到以下元素

问题描述 投票:2回答:1

1)我需要将//输入[@ name ='loc'] / parent :: div / following :: div [3]更改为Testcafe兼容扇区。下面是否有任何错误:

const locate = Selector('input')。withAttribute('name','loc')。parent('div')。sibling('div')。nth(3);

要么

const locate = Selector('input')。withAttribute('name','loc')。parent('div')。nextSibling('div')。nth(3);

2)我们是否有任何加载项/工具来评估TestCafe选择器(如ChroPath,xpath-finder等)?

const locate = Selector('input')。withAttribute('placeholder','loc')。parent('div')。sibling('div')。nth(3);

automated-tests e2e-testing web-testing testcafe
1个回答
2
投票

我会说最好的候选人是const locate = Selector('input').withAttribute('name','loc').parent('div').nextSibling('div').nth(3);

验证Selector的一种简单方法是使用TestCafe断言API:

await t
  .expect(locate.with({visibilityCheck : true}).exists)
  .ok()
  .hover(locate);
© www.soinside.com 2019 - 2024. All rights reserved.