我有用于网络抓取的 Python 脚本。我正在使用 papermill 运行它,然后我创建了一个批处理文件,我在任务计划程序上使用它来运行。在我的虚拟机更新之前,此工作流程运行良好。我能够成功手动运行它或“仅在用户登录时运行”而没有任何错误。
When the option Run whether user is logged on or not is selected, It just hangs at a step where it needs to open a browser to log in and then after 20-30 mintutes, It gives me time-out session error as below:
SessionNotCreatedException: Message: session not created
from timeout: Timed out receiving message from renderer: 600.000
(Session info: chrome=93.0.4577.82)
我尝试过的事情:
- 我已选中“以最高权限运行”框
- 我检查了chrome版本的版本,一切都是最新的
- Start in 选项已添加
- 仅当网络连接可用时启动具有“任何连接”
- 触发器已选中已启用选项
这就是我的 .bat 文件的样子:
@echo off
SET LOGFILE=C:\path\logs\log-%date%.txt
echo on
call :logit >>%LOGFILE%
exit /b 0
:logit
echo "Activate the anaconda prompt for the remaining commands."
echo "Note that the ProgramData folder is a hidden item."
call C:\path\Scripts\activate.bat
echo "Change directory at anaconda prompt to application location."
cd C:\path
echo "Run the Python application"
python papermill.py
echo "Use taskkill to end the geckodriver.exe task."
taskkill /im geckodriver.exe /f
exit
echo "Close the command prompt."
@timeout 6 >nul
请根据我的尝试提出建议