Source code for capybara.driver.node

[docs]class Node(object): """ The base class for nodes returned by a driver. Args: driver (driver.Base): The driver used to find this node. native (object): The native element object returned by the driver's browser. """ def __init__(self, driver, native): self.driver = driver self.native = native def __eq__(self, other): raise NotImplementedError() def __hash__(self): raise NotImplementedError() @property def tag_name(self): """ str: The tag name of the node. """ raise NotImplementedError() @property def visible(self): """ bool: Whether or not the node is visible. """ raise NotImplementedError() @property def value(self): """ str: The value of the node. """ raise NotImplementedError()
[docs] def style(self, styles): """ Returns the computed values of the given styles. Args: styles (List[str]): The desired styles. Returns: Dict[str, str]: The computed styles. """ raise NotImplementedError()
@property def selected(self): """ bool: Whether this is a selected option node. """ raise NotImplementedError() @property def multiple(self): """ bool: Whether this is a multi-select node. """ raise NotImplementedError() @property def text(self): """ str: The text of the node. """ raise NotImplementedError() @property def path(self): """ str: An XPath expression describing where on the page the node can be found. """ raise NotImplementedError() @property def all_text(self): """ str: All of the text of the node. """ raise NotImplementedError() @property def visible_text(self): """ str: Only the visible text of the node. """ raise NotImplementedError() def __getitem__(self, name): """ Returns the value of a given attribute of this node. Args: name (str): The name of the desired attribute. Returns: str: The value of the desired attribute. """ raise NotImplementedError()
[docs] def click(self, *keys, **offset): """ Clicks on this node. """ raise NotImplementedError()
[docs] def double_click(self, *keys, **offset): """ Double-click the node. """ raise NotImplementedError()
[docs] def drag_to(self, node): """ Drag the element to the given other element. :: source = page.find("#foo") target = page.find("#bar") source.drag_to(target) Args: node (Element): The element to drag to. """ raise NotImplementedError()
[docs] def hover(self): """ Hover on the node. """ raise NotImplementedError()
[docs] def right_click(self, *keys, **offset): """ Right-click the node. """ raise NotImplementedError()
[docs] def select_option(self): """ Selects this option node. """ raise NotImplementedError()
[docs] def send_keys(self, *args): """ Send keystrokes to the node. Examples:: from selenium.webdriver.common.keys import Keys element.send_keys("foo") # => value: "foo" element.send_keys("tet", Keys.LEFT, "s") # => value: "test" Args: *args: Variable length list of keys to send. """ raise NotImplementedError()
[docs] def set(self, value, **options): """ Sets the value of this node. Args: value (bool | str): The desired value. **options: Driver-specific options for how to set a value on a node. """ raise NotImplementedError()
[docs] def unselect_option(self): """ Deselects this option node. """ raise NotImplementedError()
@property def checked(self): """ bool: Whether this node is checked. """ raise NotImplementedError() @property def selected(self): """ bool: Whether this node is selected. """ raise NotImplementedError() @property def disabled(self): """ bool: Whether this node is disabled. """ raise NotImplementedError() @property def readonly(self): """ bool: Whether the node is read-only. """ raise NotImplementedError()