简体   繁体   中英

Python win32gui to scroll internet explorer/Firefox/Web browser window

I've gotten it to work by sending it the up/down key and/or page down/up key but I want a more native way to do it, specifically to scroll X amount.

I've tried these:

win32gui.PostMessage(self.find_scrollable(), win32con.WM_MOUSEWHEEL, win32con.WHEEL_DELTA * 3)

win32gui.PostMessage(self.find_scrollable(), win32con.WM_VSCROLL, win32con.SB_LINEDOWN)

Without success.

However these work:

    win32gui.PostMessage(window, win32con.WM_KEYDOWN, key)
    win32gui.PostMessage(window, win32con.WM_KEYUP, key)

You may want to try PyWinauto. It will give you more tools to work with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM