更改语言同时获取带空格的和不带空格的style

This commit is contained in:
work
2025-08-21 18:32:13 +08:00
parent c156f7a5ff
commit 54a6969df3

View File

@@ -25,7 +25,7 @@ from exceptions import AuthException, OperationFailed
from miniofile import client, put_object
# 登录, 检查账号, 获取账号配置, 更新账号配置是否隐藏浏览器
HEADLESS = True
HEADLESS = False
def sleep(a, b=None):
@@ -59,8 +59,11 @@ def update_windows_distinguish(x=1920, y=1080):
def _change_language(page):
sleep(2, 3)
# 找到顶部头像按钮并点击
page.wait_for_selector('div[role="button"] svg image[style*="height:40px"][style*="width:40px"]',
timeout=10000).click(force=True)
selector = '''
div[role="button"] svg image[style*="height: 40px"][style*="width: 40px"],
div[role="button"] svg image[style*="height:40px"][style*="width:40px"]
'''
page.wait_for_selector(selector, timeout=10000).click(force=True)
sleep(1, 2)
# 点击设置图标
page.wait_for_selector('//div[@role="list"]/div[@role="listitem"][1]', timeout=30000).click(force=True)