6

How can I command a window to go to end of page with xdotool?

  • "key End" seems to send and End keystroke, but nothing happens: xdotool selectwindow key End

  • "click 5" scrolls down, but how to know if the page has reached the end?

Also, the PageUp and PageDown keys doesn't seem to be accepted.

run on Ubuntu 12.04

nightcod3r
  • 752
  • 1
  • 7
  • 26

4 Answers4

16

xdotool is finicky about page up and page down. It doesn't recognize 'PgUp' or 'PageUp' or 'Page-Up'. What seems to work:

xdotool key Page_Up

and

xdotool key Page_Down
earthling42
  • 916
  • 10
  • 15
6

You can simple test it. Open your browser. Scroll to the top of page. Run this code in terminal. Switch back to browser. After 4 seconds, xdotool emulate End key

xdotool key --delay 4000 End
evandrix
  • 6,041
  • 4
  • 27
  • 38
funivan
  • 3,323
  • 1
  • 14
  • 19
  • You can also select the window by windowid (`wmctrl -lp`), or search for it. E.g. `xdotool search "x11" key End`. That way you don't have to worry about clicking to the window and waiting for any length of time. And if you put it in a loop with a little `sleep`, you can automatically inifinite scroll websites like Tumblr. =) –  Dec 30 '15 at 05:52
2

For me in the Terminal the following line works:

xdotool key Shift+Page_Up && sleep 3 && xdotool key Shift+End

so I think

xdotool key End

should go to the end of the current window.

As for the comment "it doesn't involve programming" - you can program linux macros with xdotool. It is not usual programming language but one could argue...

pirad
  • 205
  • 2
  • 8
2

Use the below code:

xdotool keydown End

sleep 1s

xdotool keyup End

You have to do

keyup End

after

keydown End 

otherwise the End key will remain pressed. The sleep 1s is to let the action be performed.

jkdev
  • 11,360
  • 15
  • 54
  • 77
Darst
  • 21
  • 1