1、安装python 运行环境 参考下面
2、 安装selenium 运行环境 参考下面
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
driver = r"C:\Program Files\edgedirver\msedgedriver.exe"
url = "https://tp.1safety.cc/student/train"
browser = webdriver.Edge(executable_path=driver)
browser.get(url)
username_ = "xxxxxxx" # stands for !@user
password_ = "Aqpx@258"
time.sleep(3)
user = browser.find_elements(By.TAG_NAME, 'input')[0]
user.send_keys(username_)
password = browser.find_elements(By.TAG_NAME, 'input')[1]
password.send_keys(password_)
# 人工输入验证码并等待程序自动点击登录
x = int(input("输入运行__次: [500次]") or 500)
y = int(input("输入运行间隔__秒: [4分钟]") or 240)
i = 1 # 列表号
n = 1 # 总循环次数
while i:
try:
browser.find_elements(By.CLASS_NAME, 'tabContent-item')[i].click()
except:
i = 0
try:
browser.find_elements(By.CLASS_NAME, 'tabContent-item')[i].click()
except:
print("未找到列表,请打开列表")
if n == x: # 退出循环
break
print('第%s秒 i=%s' % (n * y, i))
time.sleep(y)
i = i + 1
n = n + 1
版权声明:本文为oMoZhe原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。