量角器向元素(div 等)发送滚动命令 [英] Protractor send a scroll command to an element (div etc)
问题描述
在量角器端到端测试中,如何设置元素(例如 div)的滚动值,而不是整个页面.
通过jQuery,人们可以简单地调用例如$('.myElement').scrollTop(100);
.这是因为在我的端到端测试中,我想测试当一个特定的
必须已滚动以保持同步. 解决方案 selenium 不提供在元素级别滚动的方法.
如果 jquery 代码进行滚动,则在浏览器中像这样运行该代码
driver.executeScript("$('.myElement').scrollTop(100);");
In protractor end to end test, how can one set the scroll value of an element (e.g. div), not entire page.
Something which by jQuery, one would simply call for example $('.myElement').scrollTop(100);
. This is because in my end to end test, I want to test that when one particular <div>
has scrolled, I want to assert that another <div>
must have be scrolled to keep in sync.
解决方案 selenium doesn't provide way to scroll at an element level.
if the jquery code does the scrolling, then run that code inside the browser like this
driver.executeScript("$('.myElement').scrollTop(100);");
这篇关于量角器向元素(div 等)发送滚动命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文