Python automatically refresh webpage

Whether an article on a news website is good or not depends on the number of views. There is a lot of pageviews, and the boss is happy to see it.
Because the unit network has just been established, it is not very complicated. Each time a PV is added, the number of views is increased by 1. So I wrote a simple Python script to replace the work of F5.

# coding = utf-8
import time
from selenium import webdriver

def refresh(url,num):
    driver = webdriver.Chrome("E:/chromedriver.exe")
    driver.get(url)
    for i in range(num):
        time.sleep(0.01)
        driver.refresh()
    driver.close()

if __name__ == "__main__":
    url = input("Please enter the url:\n")
    num = int(input("Enter the number of refresh:\n"))
    refresh(url,num)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324781018&siteId=291194637
Recommended