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);
我会说最好的候选人是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);