This commit is contained in:
zjf 2025-05-29 17:56:51 +08:00
parent beb4b396b8
commit 5f921bbf81
1 changed files with 27 additions and 27 deletions

View File

@ -271,15 +271,15 @@ async def do_finalized_product(current_product_id: str,
f"****** Finalized product session - Start: {start_time}, End: {last_live_time}, Duration: {duration}ms, Product: {current_product_name}")
async def init_load(page):
await page.wait_for_selector("[data-e2e='live-promotion-list']", timeout=60000)
await page.wait_for_function(
"""() => {
const element = document.querySelector('[data-e2e="live-promotion-list"]');
return element && element.innerText !== "加载中";
}""",
timeout=60000
)
async def init_load(page:Page):
# await page.wait_for_selector("[data-e2e='live-promotion-list']", timeout=60000)
# await page.wait_for_function(
# """() => {
# const element = document.querySelector('[data-e2e="live-promotion-list"]');
# return element && element.innerText !== "加载中";
# }""",
# timeout=60000
# )
promotion_list_js = """(function() {
const selectors = ['[data-e2e="live-promotion-list"]', '.promotion-list'];
for (const sel of selectors) {
@ -350,25 +350,25 @@ async def do_explaining(current_product_id, current_product_img, current_product
async def refresh_page(page: Page):
try:
# await page.reload(timeout=60000)
# await page.wait_for_load_state("networkidle", timeout=60000)
# await page.wait_for_selector("[data-e2e='live-promotion-list']", timeout=60000)
# await page.wait_for_function(
# """() => {
# const element = document.querySelector('[data-e2e="live-promotion-list"]');
# return element && element.innerText !== "加载中";
# }""",
# timeout=60000
# )
await page.reload(timeout=60000)
await page.wait_for_load_state("networkidle", timeout=60000)
await page.wait_for_selector("[data-e2e='live-promotion-list']", timeout=60000)
await page.wait_for_function(
"""() => {
const element = document.querySelector('[data-e2e="live-promotion-list"]');
return element && element.innerText !== "加载中";
}""",
timeout=60000
)
svg = page.locator('#__living_right_panel_id svg').first
await svg.click()
print("已点击关闭标签的 SVG 图标")
await page.wait_for_timeout(3 * 1000)
await page.get_by_text("全部商品").click()
print("已点击 全部商品 ")
await page.wait_for_timeout(3 * 1000)
# svg = page.locator('#__living_right_panel_id svg').first
# await svg.click()
# print("已点击关闭标签的 SVG 图标")
# await page.wait_for_timeout(3 * 1000)
#
# await page.get_by_text("全部商品").click()
# print("已点击 全部商品 ")
# await page.wait_for_timeout(3 * 1000)
# page.get_by_text("继续播放").click()
# page.wait_for_timeout(3 * 000)