一、学习网址
http://hnjj.haacee.org.cn/
二、学习代码[Python] 纯文本查看 复制代码 from selenium import webdriver
import pyautogui
import time
import re
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
username="你的账号"
passwd="你的密码"
login_url='http://hnjj.haacee.org.cn/'
browser=webdriver.Firefox()
browser.maximize_window()
browser.get(login_url)
browser.implicitly_wait(10)
elem=browser.find_element_by_id("username")
elem.send_keys(username)
time.sleep(1)
elem=browser.find_element_by_id("pwd")
elem.send_keys(passwd)
time.sleep(1)
code_num=pyautogui.prompt("请输入验证码:")
elem=browser.find_element_by_id("yzm")
elem.send_keys(code_num)
time.sleep(3)
elem=browser.find_element_by_xpath('//*[@id="home"]/button')
elem.click()
time.sleep(3)
browser.get('你要学习的网址')
time.sleep(3)
pyautogui.confirm("请确认是否开启加载flash……")
video_num=browser.execute_script("return document.getElementsByClassName('badge').length")
print(video_num)
time.sleep(3)
for i in range(0,int(video_num)):
print("正在学习第{}个视频".format(i+1))
video_progress=browser.execute_script("return document.getElementsByClassName('badge')[{}].innerText".format(i))
print(video_progress)
time.sleep(1)
if "100%" not in video_progress:
browser.execute_script("document.getElementsByClassName('badge')[{}].click()".format(i))
time.sleep(3) |