我正在尝试使用 Leadfoot 模块对实习生和硒进行功能测试。
对于这个测试,我试图在一个地方单击一个按钮,然后检查页面上其他地方的元素的显示属性。
我找不到扩展 findById 调用搜索的方法,所以我尝试使用 session 属性,这似乎有效,但结果一切都返回了一个承诺。
我发现使它工作的唯一方法是链接 then 函数。是什么让会话(及其函数返回的元素)不同?
return this.remote
.findById('buttonContainer')
.findByClassName('buttonClass')
.click()
.session
.findById('stagePanel')
.then(function(element) {
element.findByClassName('itemList')
.then(function(element) {
element.getComputedStyle('display')
.then(function (display) {
// check display property
});
});
});
我确信我做错了很多事情,所以任何和所有的建议都值得赞赏。