本帖最后由 zysanjing1 于 2020-5-18 20:54 编辑
[Python] 纯文本查看 复制代码 #!/usr/bin/python
# -*- coding: utf-8 -*-
from selenium import webdriver
import selenium.webdriver.support.ui as ui
url = "http://*.*.*.*/?PersonID="
ID = input('你的学号:')
print("你的学号是:" + ID)
print("正在加载...")
driver = webdriver.Chrome()
driver.get(url + ID)
wait = ui.WebDriverWait(driver,10)
wait.until(lambda driver: driver.find_element_by_xpath("/html/body/uni-app/uni-modal/div[2]/div[3]/div"))
driver.find_element_by_xpath("/html/body/uni-app/uni-modal/div[2]/div[3]/div").click()
print("正在签到...")
wait = ui.WebDriverWait(driver,10)
wait.until(lambda driver: driver.find_element_by_xpath("/html/body/uni-app/uni-page/uni-page-wrapper/uni-page-body/uni-view/uni-view[3]/uni-view/uni-form/span/uni-view[12]/uni-button"))
driver.find_element_by_xpath("/html/body/uni-app/uni-page/uni-page-wrapper/uni-page-body/uni-view/uni-view[3]/uni-view/uni-form/span/uni-view[12]/uni-button").click()
print("签到完成...")
wait = ui.WebDriverWait(driver,10)
wait.until(lambda driver: driver.find_element_by_xpath("/html/body/uni-app/uni-modal/div[2]/div[3]/div"))
driver.quit()
这样舒服多了 |