From 5f921bbf81dcdc7d4c499414c9feaaa536b090aa Mon Sep 17 00:00:00 2001 From: zjf Date: Thu, 29 May 2025 17:56:51 +0800 Subject: [PATCH] rpa m --- src/cluster/rpa.py | 54 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/cluster/rpa.py b/src/cluster/rpa.py index 2f0d571..6d4876c 100644 --- a/src/cluster/rpa.py +++ b/src/cluster/rpa.py @@ -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)