wait for elements

This commit is contained in:
Leo Song
2025-10-24 16:31:43 +08:00
parent 2dbedcc206
commit 2f95a5512c
+2
View File
@@ -257,6 +257,7 @@ class DouYinVideo(object):
"""处理商品编辑弹窗""" """处理商品编辑弹窗"""
await page.wait_for_timeout(2000) await page.wait_for_timeout(2000)
await page.wait_for_selector('input[placeholder="请输入商品短标题"]', timeout=10000)
short_title_input = page.locator('input[placeholder="请输入商品短标题"]') short_title_input = page.locator('input[placeholder="请输入商品短标题"]')
if not await short_title_input.count(): if not await short_title_input.count():
douyin_logger.error("[-] 未找到商品短标题输入框") douyin_logger.error("[-] 未找到商品短标题输入框")
@@ -292,6 +293,7 @@ class DouYinVideo(object):
"""设置商品链接功能""" """设置商品链接功能"""
try: try:
# 定位"添加标签"文本,然后向上导航到容器,再找到下拉框 # 定位"添加标签"文本,然后向上导航到容器,再找到下拉框
await page.wait_for_selector('text=添加标签', timeout=10000)
dropdown = page.get_by_text('添加标签').locator("..").locator("..").locator("..").locator(".semi-select").first dropdown = page.get_by_text('添加标签').locator("..").locator("..").locator("..").locator(".semi-select").first
if not await dropdown.count(): if not await dropdown.count():
douyin_logger.error("[-] 未找到标签下拉框") douyin_logger.error("[-] 未找到标签下拉框")