How to trigger a window.scrollTo(x, y) in phantomJS

北城余情 提交于 2019-12-11 02:17:02

问题


I open a web page, and I want trigger a scrolling in onLoadFinished callback. but it dose't working. I also tried scrollPosition and set timer to sent key event. Both of them dose't working. So ask for help.

page.onLoadFinished = function() {
    window.scrollTo(0, document.height);
}

page.open('http://www.XXX.com', function (status) {
    if (status !== 'success') {
        console.log('Unable to open weibo.com');
    }
}

回答1:


Why would you need scrolling if you could open the page in the whole size? Just set size of the page to be whatever size you need.



来源:https://stackoverflow.com/questions/15741973/how-to-trigger-a-window-scrolltox-y-in-phantomjs

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