Cucumber Capybara scroll to bottom of page

[亡魂溺海] 提交于 2019-12-21 06:46:58

问题


I'd like to use my Cucumber/Capybara setup to test endless scroll by driving a browser and scrolling to the bottom of the page to ensure that the new content is loaded. Is there a way to do this?


回答1:


You could use javascript to achieve this:

page.execute_script "window.scrollBy(0,10000)"



回答2:


I solved this with visit '#footer' inside a "scroll to the bottom of the page" step.



来源:https://stackoverflow.com/questions/4424790/cucumber-capybara-scroll-to-bottom-of-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!