LucianoGanga / simple-headless-chrome

Simple abstraction to use Chrome as a Headless Browser with Node JS
MIT License
217 stars 50 forks source link

Simulate keyBoardEvent 'End/PageDown' on the loaded Page #71

Closed ayushbits closed 7 years ago

ayushbits commented 7 years ago

I am trying to load a page and go to the End of the page using following code :

    await mainTab.goTo('https://github.com/LucianoGanga/simple-headless-chrome')
    await mainTab.wait(2000)
    await mainTab.keyboardEvent('keyUp', 'End')
    await mainTab.keyboardEvent('keyDown', 'End')

But it is not working . I have seen documentation in the code , Input.dispatchKeyEvent of chrome-devtools. However, none of them is working. Could somebody help ?

ayushbits commented 7 years ago

Answer is

   await mainTab.goTo('https://github.com/LucianoGanga/simple-headless-chrome')
    await mainTab.wait(2000)
    await mainTab.keyboardEvent('keyUp', 'End',0,35)
    await mainTab.keyboardEvent('keyDown', 'End',0,35)