sydomain

思绪来的快,去的也快,偶尔在这里停留。

python页面滚动讲解

用法一

#页面向下滚动500像素
pyautogui.FAILSAFE = False
pyautogui.scroll(-500)
time.sleep(2)
print("页面已滚动")

用法二

import pyautogui
#为了效果明显,我们使用一个循环进行观察
pyautogui.FAILSAFE = False
while True :
    pyautogui.scroll(-200)

此效果可以用在观察页面的时候进行启动,如果想模拟人为操作,比如向下移动三次停止,每次500像素并停留五秒,请看用法三


用法三

import pyautogui
import time

# 向下移动三次停止,每次1000像素并停留五秒
pyautogui.FAILSAFE = False
scroll_count = 0

while scroll_count < 3:
    pyautogui.scroll(-1000)
    scroll_count += 1
    time.sleep(5)



Powered By sydomain

Copyright Your WebSite.Some Rights Reserved.