Files
37duAutomation/plugins/XQ0001-0100/XQ0042 抖音平台核对/data/browser.py
T
puddy 259369953f refactor: 重构多插件 UI 与配置结构,新增抖音/新美大平台核对插件
- 新增 XQ0042 抖音平台核对、XQ0041 新美大平台核对插件的 UI 源码与打包脚本
- 重构续签电子签、服务岗转正不通过电子签等插件的版本与配置
- 删除旧版考勤异常处理、微盟数据导出等冗余插件文件
- 修复出勤积分更新插件的 OPM 推送判断逻辑
- 优化壳子插件页面的 iframe 滚动条样式
2026-10-28 10:51:27 +08:00

37 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""浏览器:一次运行共用一个可见浏览器(登录 + 后续取数都复用它,避免反复开关)。
独立固定用户目录 %LOCALAPPDATA%\\37duAutomation\\browser_sessions\\xq0042,
登录态跨次保留,不占用用户日常 Chrome 配置。
"""
import os
from DrissionPage import ChromiumPage, ChromiumOptions
from .. import config
def open_page():
co = ChromiumOptions()
if config.HEADLESS:
co.headless()
co.set_argument('--start-maximized')
co.set_pref('credentials_enable_service', False)
co.set_pref('profile.password_manager_enabled', False)
profile = config.get_browser_profile_dir()
os.makedirs(profile, exist_ok=True)
co.set_user_data_path(profile)
config.log(f'浏览器用户目录:{profile}', 'DEBUG')
page = ChromiumPage(co)
if not config.HEADLESS:
# 登录要人工操作(账密/短信/扫码/滑块),全屏 + 置顶避免被其它窗口挡住
config.apply_window_mode(page)
return page
def close_page(page):
try:
page.quit()
except Exception:
pass