python-archieve-projects/daily/抢座位.py

24 lines
919 B
Python

import time
from selenium import webdriver
chrome = 'X:\\Env\\chromedriver.exe'
driver = webdriver.Chrome(chrome) # 使用Chrome浏览器
driver.get("https://zwyy.jxufe.edu.cn/")
driver.find_element_by_id('username').send_keys('2202004157')
driver.find_element_by_id('password').send_keys('ki7.1102')
time.sleep(2)
driver.find_element_by_xpath('//*[@id="fm1"]/table/tbody/tr[5]/td/input').click()
time.sleep(3)
driver.get('https://zwyy.jxufe.edu.cn/Content/Index/startUp#!/Seat/QRCode/checkState?library_id=156&space_id=1356'
'&seat_id=38145')
time.sleep(3)
driver.get('https://zwyy.jxufe.edu.cn/Content/Index/startUp#!/Seat/QRCode/checkState?library_id=156&space_id=1356'
'&seat_id=38145')
elements = driver.find_elements_by_xpath('//*[@id="react-root"]/div/div/div[1]/div/div/div[1]/div[2]/div[1]/div/div/div[3]/div/div/div')
for element in elements:
print(element)
element.click()