How to reach end of page with xdotool, how to page up and down
Asked Answered
K

4

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

Koral answered 31/10, 2014 at 13:41 Comment(1)
This depends on what exactly your window can do. The question is probably off topic here as it doesn't involve programming.Servomotor
I
18

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
Impalpable answered 13/8, 2015 at 16:25 Comment(0)
A
8

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
Arable answered 10/11, 2014 at 9:20 Comment(1)
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. =)Olympium
P
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...

Purvis answered 8/11, 2014 at 16:59 Comment(0)
W
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.

Whitewood answered 1/12, 2019 at 22:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.