@@ -32,12 +32,9 @@ def create(
3232 we don't need to fetch it for every single element.
3333
3434 :param node: cdp dom node representation
35- :type node: cdp.dom.Node
3635 :param tab: the target object to which this element belongs
37- :type tab: Tab
3836 :param tree: [Optional] the full node tree to which <node> belongs, enhances performance.
3937 when not provided, you need to call `await elem.update()` before using .children / .parent
40- :type tree:
4138 """
4239
4340 elem = Element (node , tab , tree )
@@ -51,9 +48,7 @@ def __init__(self, node: cdp.dom.Node, tab: Tab, tree: cdp.dom.Node | None = Non
5148 Represents an (HTML) DOM Element
5249
5350 :param node: cdp dom node representation
54- :type node: cdp.dom.Node
5551 :param tab: the target object to which this element belongs
56- :type tab: Tab
5752 """
5853 if not node :
5954 raise Exception ("node cannot be None" )
@@ -218,7 +213,6 @@ def get(self, name: str) -> str | None:
218213 href = element.get("href")
219214
220215 :param name: The name of the attribute to retrieve.
221- :type name: str
222216 :return: The value of the attribute, or None if it does not exist.
223217 :rtype: str | None
224218 """
@@ -455,7 +449,6 @@ def __call__(self, js_method: str) -> typing.Any:
455449 calling the element object will call a js method on the object
456450 eg, element.play() in case of a video element, it will call .play()
457451 :param js_method:
458- :type js_method:
459452 :return:
460453 :rtype:
461454 """
@@ -477,11 +470,8 @@ async def apply(
477470 - function myFunction(elem) { alert(elem) }
478471
479472 :param js_function: the js function definition which received this element.
480- :type js_function: str
481473 :param return_by_value:
482- :type return_by_value:
483474 :param await_promise: when True, waits for the promise to resolve before returning
484- :type await_promise: bool
485475 :return:
486476 :rtype:
487477 """
@@ -619,16 +609,11 @@ async def mouse_drag(
619609 drag an element to another element or target coordinates. dragging of elements should be supported by the site of course
620610
621611
622- :param destination: another element where to drag to, or a tuple (x,y) of ints representing coordinate
623- :type destination: Element or coordinate as x,y tuple
624-
612+ :param destination: target Element or coordinates (x,y) to drag to
625613 :param relative: when True, treats coordinate as relative. for example (-100, 200) will move left 100px and down 200px
626- :type relative:
627-
628614 :param steps: move in <steps> points, this could make it look more "natural" (default 1),
629615 but also a lot slower.
630616 for very smooth action use 50-100
631- :type steps: int
632617 :return:
633618 :rtype:
634619 """
@@ -758,13 +743,7 @@ async def send_keys(
758743
759744 hint, if you ever get stuck where using py:meth:`~click`
760745 does not work, sending the keystroke \\ n or \\ r\\ n or a spacebar work wonders!
761-
762- when special_characters is True, it will use grapheme clusters to send the text:
763- if the character is in the printable ASCII range, it sends it using dispatch_key_event.
764- otherwise, it uses insertText, which handles special characters more robustly.
765-
766746 :param text: text to send
767- :param special_characters: when True, uses grapheme clusters to send the text.
768747 :return: None
769748 """
770749 await self .apply ("(elem) => elem.focus()" )
@@ -897,7 +876,6 @@ async def screenshot_b64(
897876 When the element is hidden, or has no size, or is otherwise not capturable, a RuntimeError is raised
898877
899878 :param format: jpeg or png (defaults to jpeg)
900- :type format: str
901879 :param scale: the scale of the screenshot, eg: 1 = size as is, 2 = double, 0.5 is half
902880 :return: screenshot data as base64 encoded
903881 :rtype: str
@@ -938,9 +916,7 @@ async def save_screenshot(
938916 When the element is hidden, or has no size, or is otherwise not capturable, a RuntimeError is raised
939917
940918 :param filename: uses this as the save path
941- :type filename: PathLike
942919 :param format: jpeg or png (defaults to jpeg)
943- :type format: str
944920 :param scale: the scale of the screenshot, eg: 1 = size as is, 2 = double, 0.5 is half
945921 :return: the path/filename of saved screenshot
946922 :rtype: str
@@ -977,10 +953,7 @@ async def flash(self, duration: typing.Union[float, int] = 0.5) -> None:
977953 """
978954 displays for a short time a red dot on the element (only if the element itself is visible)
979955
980- :param coords: x,y
981- :type coords: x,y
982956 :param duration: seconds (default 0.5)
983- :type duration:
984957 :return:
985958 :rtype:
986959 """
0 commit comments