用selenium和schedule定时自动填写学校每日位置统计的金数据问卷
环境配置:
- 查看Chrome浏览器版本:Chrome浏览器 设置-关于Chrome
- 打开 http://npm.taobao.org/mirrors/chromedriver/
下载对应版本的ChromeDriver压缩包,
解压到与代码PY文件保存位置相同的文件夹。
代码部分:
(把名字和学号换成你的;缺点是要一直挂机)
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import schedule
import time
from selenium.webdriver.common.keys import Keys
# 问卷自动填写:
def auto():
chromeOptions = webdriver.ChromeOptions()
browser = webdriver.Chrome(chrome_options=chromeOptions)
wait = WebDriverWait(browser, 10)
browser.get('https://jinshuju.net/f/vbG7ws') #问卷网址
# 姓名
name_input = wait.until(EC.pr