引言
"_blank" href="https://chromedriver.storage.googleapis.com/index.html">ChromeDriver:从ChromeDriver镜像站里找到谷歌浏览器版本号对应的文件夹并打开,从中找到对应的系统后下载。"_blank" href="https://f.wps.cn/form-write/uwDUPB2N/">WPS表单。
"text-align: left">"text-align: left">"htmlcode">
answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_"htmlcode">answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_"htmlcode">localtime = time.localtime(time.time()) if localtime.tm_hour < 7: t = 0 print("填写时间为:0700-0900") elif localtime.tm_hour < 11: t = 1 print("填写时间为:1100-1200") else: t = 2 print("填写时间为:1800-2000") answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_"htmlcode">answer = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.ant-calendar-picker'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.ant-calendar-today-btn'))) answer.click()"htmlcode">
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 time # WPS表单的网址 url = 'https://f.wps.cn/form-write/uwDUPB2N/' # 完成浏览器对象的初始化,设定超时时间为10秒。 browser = webdriver.Chrome() wait = WebDriverWait(browser, 10) browser.get(url) ################################ # 针对INPUT组件,XXX替换成自己的内容。 answer = wait.until(EC.element_to_be_clickable((By.ID, 'input_0'))) answer.send_keys('XXX') # 针对LABEL组件。 answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_1_0'))) answer.click() # 针对INPUT组件,XXX替换成自己的内容。 answer = wait.until(EC.element_to_be_clickable((By.ID, 'input_2'))) answer.send_keys('18') # 针对LABEL组件。 answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_3_0'))) answer.click() # 针对PICKER组件。 answer = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.ant-calendar-picker'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.ant-calendar-today-btn'))) answer.click() # 针对询问时间的INPUT组件。 localtime = time.localtime(time.time()) if localtime.tm_hour < 7: t = 0 print("填写时间为:0700-0900") elif localtime.tm_hour < 11: t = 1 print("填写时间为:1100-1200") else: t = 2 print("填写时间为:1800-2000") answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_5_' + str(t)))) answer.click() ################################ # 等待10秒 time.sleep(10) # 点击提交 commit = wait.until(EC.element_to_be_clickable((By.ID, 'submit_button'))) commit.click() # 确认提交 yes = wait.until(EC.element_to_be_clickable((By.ID, 'bind_phone_modal_confirm_button'))) yes.click() # 反馈成功 print('Perfect!')"htmlcode">
# 点击提交 commit = wait.until(EC.element_to_be_clickable((By.ID, 'submit_button'))) commit.click() # 确认提交 yes = wait.until(EC.element_to_be_clickable((By.ID, 'bind_phone_modal_confirm_button'))) yes.click()"htmlcode">
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 time url = '填入WPS表单的网址' browser = webdriver.Chrome() wait = WebDriverWait(browser, 10) browser.get(url) answer = wait.until(EC.element_to_be_clickable((By.ID, 'input_0'))) answer.send_keys('XXX') answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_1_1'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_2_0'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_3_0'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.ant-calendar-picker'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.ant-calendar-today-btn'))) answer.click() localtime = time.localtime(time.time()) if localtime.tm_hour < 7: t = 0 print("填写时间为:0700-0900") elif localtime.tm_hour < 11: t = 1 print("填写时间为:1100-1200") else: t = 2 print("填写时间为:1800-2000") answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_5_' + str(t)))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'input_6'))) answer.send_keys('36.6') answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_7_0'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_8_0'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_9_0'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_10_1'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_11_0'))) answer.click() answer = wait.until(EC.element_to_be_clickable((By.ID, 'select_label_wrap_12_0'))) answer.click() time.sleep(5) commit = wait.until(EC.element_to_be_clickable((By.ID, 'submit_button'))) commit.click() yes = wait.until(EC.element_to_be_clickable((By.ID, 'bind_phone_modal_confirm_button'))) yes.click() print('Perfect!')总结
以上所述是小编给大家介绍的Python3+Selenium+Chrome自动填写WPS表单,希望对大家有所帮助!
尾言
最后,祝福武汉早日康复,武汉加油!
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com
暂无“Python3+Selenium+Chrome实现自动填写WPS表单”评论...
更新日志
2024年11月13日
2024年11月13日
- 群星.1996-风月电影原声带【滚石】【WAV+CUE】
- Blast Slam S1参赛名单出炉:XG被直邀
- 《英雄联盟》Doinb想让Tian当教练:世纪大和解?
- 《忆蚀》Subliminal:揭秘后室之谜,路知行献声Weplay文化展
- 那英《征服NEWXRCD台湾版》日本压制[WAV+CUE]
- 群星《金曲百分百上》3CD(香港版)[WAV+CUE]
- 刘欢《雨中的树(新歌加精选)2CD》德国HD24K金碟[WAV+CUE]
- 郑源 《世间情歌》6N纯银SQCD[WAV+CUE][1G]
- 群星《粤潮2HQII》头版限量编号[低速原抓WAV+CUE][991M]
- 群星《2023好听新歌21》十倍音质 U盘音乐[WAV分轨][1G]
- 《热血传奇》双11感恩回馈 超值狂欢30天
- 原神5.2版本活动汇总 5.2版本活动有哪些
- 张敬轩.2010-NO.ELEVEN【环球】【WAV+CUE】
- 黄丽玲.2006-失恋无罪【艾回】【WAV+CUE】
- 阿达娃.2024-Laluna【W8VES】【FLAC分轨】