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

时间:2019-03-25 13:01:31

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

1)我需要将// input [@ name ='loc'] / parent :: div / following :: div [3]更改为与Testcafe兼容的扇区。下一个有什么问题吗?

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

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

2)我们是否有任何外接程序/工具来评估TestCafe选择器(例如ChroPath,xpath-finder等)?

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

1 个答案:

答案 0 :(得分:2)

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

验证选择器的简单方法是使用TestCafe断言API:

await t
  .expect(locate.with({visibilityCheck : true}).exists)
  .ok()
  .hover(locate);
相关问题