How do I scroll to the top of a window using applescript?

后端 未结 3 2133
不知归路
不知归路 2021-01-02 21:00

I want applescript to scroll a window all the way up.

I\'ve tried the page up key, the home key, and I\'ve tried looking for a way to scroll using the built in scro

3条回答
  •  [愿得一人]
    2021-01-02 21:37

    With browsers you could also use JavaScript:

    tell application "Safari" to tell document 1
        do JavaScript "window.scroll(0,0)"
    end tell
    
    tell application "Google Chrome" to tell active tab of window 1
        execute javascript "window.scroll(0,0)"
    end tell
    

提交回复
热议问题