[英]Scrolling to element in Selenium using intern.js and leadfoot
这有很多组成部分,我不确定问题出在哪里,但这是我的问题。 我正在使用intern.js与SauceLabs进行javascript功能测试。
以下测试通过了,但是,当我转到SauceLabs的屏幕截图查看该窗口的行为时,它无法正确滚动到该元素,因此.moveMouseTo
无法正常工作。
略有滚动,但是该元素仍然不可见。 我研究了Selenium并集中精力,但是我是intern.js的新手,所以我不确定如何从Selenium仅在此处的描述中实现该功能。
这是测试:
'added comment shows the comment added': function () {
return this.get('remote')
.get(require.toUrl('index.html'))
.setFindTimeout(500)
.setWindowSize(800, 600)
.findByCssSelector('.ht-comment-box')
.click()
.type('My New Comment')
.end()
.findByCssSelector('#addComment')
.click()
.end()
.setFindTimeout(500)
.findByCssSelector('.commentRow:last-child > .commentContent ')
.moveMouseTo()
.getVisibleText()
.then(function (text) {
assert.strictEqual(text, 'My New Comment',
'Adding a comment should display the comment. Showed instead ' + text);
});
},
滚动外观如下,添加的注释不可见。
我相信您需要传递一个元素来将moveMouseTo
var remote = this.get('remote');
return remote.get( … )
// …
.findByCssSelector( … ).then(function (element) {
return remote.moveMouseTo(element);
})
.getVisibleText();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.