diff --git a/README.md b/README.md index a26a91e..077a6bc 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ async def target_1_handler(target): async def target_2_handler(target): await target.get("about:blank") - await target.execute_script(script=read("/files/js/show_mousemove.js")) + await target.execute_script(await script=read("/files/js/show_mousemove.js")) await target.pointer.move_to(500, 500, total_time=2) @@ -224,7 +224,8 @@ move_kwargs = {"total_time": 0.7, "accel": 2, "smooth_soft": 20} await pointer.move_to(100, 500) await pointer.click(500, 50, move_kwargs=move_kwargs, move_to=True) ``` -### Iframes +### Iframes / Frames +due `swtich_to.frame()` being deprecated for driverless, use this instead ```python iframes = await driver.find_elements(By.TAG_NAME, "iframe") diff --git a/src/selenium_driverless/types/webelement.py b/src/selenium_driverless/types/webelement.py index 1c17566..c7166c7 100644 --- a/src/selenium_driverless/types/webelement.py +++ b/src/selenium_driverless/types/webelement.py @@ -197,10 +197,10 @@ async def __frame_id__(self) -> int: @property async def content_document(self): """ - **async** gets the document of the iframe + **async** gets the contentDocument element of the iframe (or frame). Returns None if this isn't an iframe. """ _desc = await self._describe() - if _desc.get("localName") == "iframe": + if _desc.get("localName") in ["iframe","frame"]: node = _desc.get("contentDocument") if node: frame_id = _desc.get("frameId")