有些时候刚建的网站,要求达到一定量的浏览量,这个时候你写个小代码就能轻松搞定了,废话不多说直接看下面代码:
import time
from selenium import webdriver #需pip install selenium
def refresh(url,num):
filename=r'C:\Program Files\Google\Chrome\Application\chromedriver.exe'
driver=webdriver.Chrome(filename)
driver.get(url)
for i in range(num):
time.sleep(1)
driver.refresh()
driver.close()
if __name__ == '__main__':
url='https://blog.csdn.net/weixin_40343504/article/details/111492352'
#url=input('请输入你想刷新的网址:')
num=int(input('请输入需要刷新次数:'))
refresh(url,num)