Javascript 使用intern.js和leadfoot滚动到Selenium中的元素
有这么多的组成部分,我不知道问题发生在哪里,但这是我的问题。我正在使用intern.js对SauceLabs进行javascript功能测试 但是,下面的测试通过了,当我转到SauceLabs的屏幕截图查看窗口的行为时,它没有正确地滚动到元素,因此Javascript 使用intern.js和leadfoot滚动到Selenium中的元素,javascript,selenium,intern,saucelabs,Javascript,Selenium,Intern,Saucelabs,有这么多的组成部分,我不知道问题发生在哪里,但这是我的问题。我正在使用intern.js对SauceLabs进行javascript功能测试 但是,下面的测试通过了,当我转到SauceLabs的屏幕截图查看窗口的行为时,它没有正确地滚动到元素,因此.moveMouseTo工作不正常 有一点滚动,但元素仍然不可见。我研究了Selenium和focus,但我对intern.js是新手,所以我不确定如何从这里的Selenium-only帖子中的描述实现这一点 以下是测试: 'added comment
.moveMouseTo
工作不正常
有一点滚动,但元素仍然不可见。我研究了Selenium和focus,但我对intern.js是新手,所以我不确定如何从这里的Selenium-only帖子中的描述实现这一点
以下是测试:
'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();
我相信您需要将一个元素传递给
moveMouseTo
var remote = this.get('remote');
return remote.get( … )
// …
.findByCssSelector( … ).then(function (element) {
return remote.moveMouseTo(element);
})
.getVisibleText();