support select2 in iframe (#560)

This commit is contained in:
LawyZheng
2024-07-06 13:32:55 +08:00
committed by GitHub
parent 6929a1d24d
commit e52d585f9f
4 changed files with 62 additions and 21 deletions

View File

@@ -318,10 +318,10 @@ async def get_page_content(page: Page, timeout: float = PAGE_CONTENT_TIMEOUT) ->
return await page.content()
async def get_select2_options(page: Page, element: ElementHandle) -> list[dict[str, Any]]:
await page.evaluate(JS_FUNCTION_DEFS)
async def get_select2_options(frame: Page | Frame, element: ElementHandle) -> list[dict[str, Any]]:
await frame.evaluate(JS_FUNCTION_DEFS)
js_script = "async (element) => await getSelect2Options(element)"
return await page.evaluate(js_script, element)
return await frame.evaluate(js_script, element)
async def get_interactable_element_tree_in_frame(