|
|
@@ -1,3 +1,26 @@
|
|
|
+"""
|
|
|
+日报自动化填写脚本
|
|
|
+
|
|
|
+依赖安装:
|
|
|
+1. 安装Python依赖包:
|
|
|
+ pip install playwright
|
|
|
+ pip install psutil
|
|
|
+ pip install asyncio
|
|
|
+
|
|
|
+2. 安装Playwright浏览器:
|
|
|
+ playwright install chromium
|
|
|
+
|
|
|
+注意事项:
|
|
|
+1. 确保Chrome浏览器已安装
|
|
|
+2. 脚本使用Chrome用户配置文件,路径为:C:\Users\zhens\AppData\Local\Google\Chrome\User Data
|
|
|
+3. 运行前请确保没有其他Chrome进程在运行
|
|
|
+4. 脚本会自动关闭所有Chrome进程,请确保没有重要工作未保存
|
|
|
+5. 如果修改了Chrome用户配置路径,需要相应修改代码中的user_data_dir变量
|
|
|
+6. 脚本运行时会打开Chrome浏览器窗口,请勿手动操作浏览器
|
|
|
+7. 如果遇到网络问题,可以适当增加等待时间(asyncio.sleep的值)
|
|
|
+8. 如果提交失败,可以检查网络连接或适当增加等待时间
|
|
|
+"""
|
|
|
+
|
|
|
import asyncio
|
|
|
import os
|
|
|
import psutil
|
|
|
@@ -104,7 +127,7 @@ async def run(playwright):
|
|
|
# 明日工作计划输入
|
|
|
# 1. 先点击输入框,确保获得焦点
|
|
|
await page.locator('div.question:has-text("明日工作计划") .maileditor-editorview[contenteditable="true"]').click()
|
|
|
- # 2. 使用键盘输入方式模拟真实输入
|
|
|
+ # 2. 使用键盘输入方式模拟真实输入,如果通过代码编辑,会导致输入栏没有任何信息
|
|
|
await page.keyboard.type(plan_text)
|
|
|
# 3. 等待输入完成
|
|
|
await asyncio.sleep(2)
|