Python API

XPathHelper: (xh)

class xpath_helper.XPathHelper(currentPath: Optional[List[str]] = None)
empty()

Empties the current path.

get_ancestor(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, that are ancestors, or the parent, and the parent’s parent, and so on, to the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_ancestor_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, that are ancestors, or the parent, and the parent’s parent, and so on, to the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_ancestor_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, that are ancestors, or the parent, and the parent’s parent, and so on, to the node in reference.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_ancestor_or_self(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, that are ancestors, or the parent, and the parent’s parent, and so on, including the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_ancestor_or_self_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, that are ancestors, or the parent, and the parent’s parent, and so on, including the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_ancestor_or_self_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, that are ancestors, or the parent, and the parent’s parent, and so on, including the node in reference.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_child(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code> immediately below the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_child_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, immediately below the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_child_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, immediately below the node in reference.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_descendant(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, below the node in reference no matter the depth.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_descendant_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, below the node in reference no matter the depth.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_descendant_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, below the node in reference no matter the depth.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_descendant_or_self(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, below the current node, but also returns the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_descendant_or_self_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, below the current node, but also returns the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_descendant_or_self_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, below the current node, but also returns the node in reference.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_element(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, below the node in reference no matter the depth. This self method is a synonym of <code>get_descendant</code>.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_element_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, below the node in reference no matter the depth. This method is a synonym of <code>get_descendant_by_svg_tag</code>.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_element_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, below the node in reference no matter the depth. This method is a synonym of <code>get_descendant_by_tag</code>.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_element_by_xpath(xpath: str) xpath_helper.xpath_helper.XPathHelper

Selects an element with an XPath selector <code>xpath</code>.

Args:

xpath (str): [description]

Returns:

XPathHelper: a new instance of XPathHelper

get_following(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, that are located on parent-level and also after (following) its parent of the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_following_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, that are located on parent-level and also after (following) its parent of the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_following_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, that are located on parent-level and also after (following) its parent of the node in reference.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_following_sibling(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, that are located on the same level who are located after (following) the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_following_sibling_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, that are located on the same level who are located after (following) the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_following_sibling_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, that are located on the same level who are located after (following) the node in reference.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_parent() xpath_helper.xpath_helper.XPathHelper

Selects the parent of the current element.

Returns:

XPathHelper: a new instance of XPathHelper

get_preceding(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, that are located on parent-level and also before (preceding) its parent of the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_preceding_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, that are located on parent-level and also before (preceding) its parent of the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_preceding_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, that are located on parent-level and also before (preceding) its parent of the node in reference.

Args:

tag (str): tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_preceding_sibling(filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes filtered by <code>filter</code>, that are located on the same level who are also located before (preceding) the node in reference.

Args:

filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_preceding_sibling_by_svg_tag(svg_tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the SVG nodes with SVG tag <code>svg_tag</code> filtered by <code>filter</code>, that are located on the same level who are also located before (preceding) the node in reference.

Args:

svg_tag (str): SVG tag name filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

get_preceding_sibling_by_tag(tag: str, filter: Optional[xpath_helper.filter.ValidExpressionFilter] = None) xpath_helper.xpath_helper.XPathHelper

Selects the nodes with tag <code>tag</code> filtered by <code>filter</code>, that are located on the same level who are also located before (preceding) the node in reference.

Args:

tag (string): [description] filter (Filter): filter to apply

Returns:

XPathHelper: a new instance of XPathHelper

Filter: (filter)

ValidExpressionFilter

class xpath_helper.filter.ValidExpressionFilter(current_path: Optional[List[str]] = None)
and_operator(*filters: xpath_helper.filter.EmptyFilter) xpath_helper.filter.ValidExpressionFilter

Adds one or more filter expression to the current one with the AND logical operator.

Args:

filters (list[Filter]): List of filters List of filters that will be added with the AND logical operator

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

empty()

Empties the current path.

is_empty() bool

Returns true if filter is empty.

Returns:

bool: true if filter is empty

or_operator(*filters: xpath_helper.filter.EmptyFilter) xpath_helper.filter.ValidExpressionFilter

Adds one or more filter expression to the current one with the OR logical operator.

Args:

filters (list[Filter]): List of filters that will be added with the OR logical operator

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

EmptyFilter

class xpath_helper.filter.EmptyFilter(currentPath=None)
attribute_contains(attribute: str, value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with the attribute <code>attribute</code> containing the value <code><value</code>.

Args:

attribute (str): attribute name value (str): attribute value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

attribute_equals(attribute: str, value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with the attribute <code>attribute</code>, whose value equals <code><value</code>.

Args:

attribute (str): attribute name value (str | int | float): attribute value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

attribute_greater_than(attribute: str, value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with the attribute <code>attribute</code>, whose value is greater than <code><value</code>.

Args:

attribute (str): attribute name value (int | float): attribute value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

attribute_greater_than_or_equal_to(attribute: str, value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with the attribute <code>attribute</code>, whose value is greater than or equal to <code><value</code>.

Args:

attribute (str): attribute name value (int | float): attribute value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

attribute_less_than(attribute: str, value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with the attribute <code>attribute</code>, whose value is less than <code><value<code>.

Args:

attribute (str): attribute name value (int | float): attribute value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

attribute_less_than_or_equal_to(attribute: str, value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with the attribute <code>attribute</code>, whose value is less than or equal to <code><value</code>.

Args:

attribute (str): attribute name value (int | float): attribute value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

attribute_not_equals(attribute: str, value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with the attribute <code>attribute</code>, whose value doesn’t equal <code><value</code>.

Args:

attribute (str): attribute name value (str | int | float): attribute value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

get(index: int)

Selects the node element who is positioned at the <code>index</code> position in its parent children list.

Args:

index (int): index of the element in the list

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

get_first()

Selects the node element who is positioned first in its parent children list.

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

get_last()

Selects the node element who is positioned last in its parent children list.

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

has_attribute(attribute: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes that have the attribute <code>attribute</code>.

Args:

attribute (str): attribute name

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

not_operator(filter: xpath_helper.filter.ValidExpressionFilter)

Reverses the filter <code>filter</code>. Returns true when the filter returns false and true when the filter returns false.

Args:

filter ([type]): [description]

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

value_contains(value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes containing the value <code><value</code>.

Args:

value (str): value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

value_equals(value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes whose value equals <code><value</code>.

Args:

value (str | int | float): value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

value_greater_than(value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes whose value is greater than <code><value</code>.

Args:

value (int | float): value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

value_greater_than_or_equal_to(value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes whose value is greater than or equal to <code><value</code>.

Args:

value (int | float): value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

value_less_than(value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes whose value is less than <code><value</code>.

Args:

value (int | float): value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

value_less_than_or_equal_to(value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes whose value is less than or equal to <code><value</code>.

Args:

value (int | float): value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.

value_not_equals(value: str) xpath_helper.filter.ValidExpressionFilter

Selects the nodes with whose value doesn’t equal <code><value</code>.

Args:

value (str | int | float): value

Returns:

ValidExpressionFilter: a new instance of ValidExpressionFilter with the newly formed expression.