我创建了一个用于访问网页的漫游器
import os
import time
import webbrowser
cycles=int(input("Please input the number of cycles you want to run")) #1
num=int(input("Please input the number of pages you want to open in each cycle")) #1
delay=int(input("Please input the time delay for restarting the cycle")) #5
website = input("Please input your web address") #https://www.youtube.com/watch?v=izvi4vBqkYw
hits=cycles*num
print("You will access " +website+ " " , hits, " times")
for i in range(cycles):
for i in range(num):
webbrowser.open(website)
time.sleep(delay)
os.system("tskill /A Chrome")
但是,如果出于某种原因运行此程序,它将在Internet Explorer而不是Chrome上打开。即使这样,它仍然显示404错误,提示无法加载任何页面的网页。 请随时使用任何YouTube页面。在此示例中,我使用了:https://www.youtube.com/watch?v=izvi4vBqkYw