The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Brownie::Node - base class of Brownie::Node series

METHODS

  • new(%args)

    Returns a new instance.

    my $node = Brownie::Node->new(%args);

    %args are:

    • driver: parent Brownie::Driver instance

    • native: native driver specific node representation instance

  • driver

    Returns a driver instance.

    my $driver = $node->driver;
  • native

    Returns a native node instance.

    my $native = $node->native;
  • attr($name)

    Returns an attribute value.

    my $title = $node->attr('title');
  • value

    Returns the value of element.

    my $value = $node->value;
  • text

    Returns a child node text. (= innerText)

    my $text = $node->text;
  • tag_name

    Returns a tag name.

    my $tag_name = $node->tag_name;
  • is_displayed, is_not_displayed

    Whether this element is displayed, or not.

    if ($node->is_displayed) {
        print "this node is visible";
    }
    
    if ($node->is_not_displayed) {
        warn "this node is not visible";
    }
  • is_checked, is_not_checked

    Whether this element is checked, or not. (checkbox)

    if ($checkbox->is_checked) {
        print "marked";
    }
    
    if ($checkbox->is_not_checked) {
        warn "unmarked...";
    }
  • is_selected, is_not_selected

    Whether this element is selected, or not. (radio, option)

    if ($radio->is_selected) {
        print "this radio button is selcted";
    }
    
    if ($option->is_not_selected) {
        warn "this option element is not selected";
    }
  • set($value)

    Sets value to this element. (input, textarea)

    $input->set($value);
    $textarea->set($text);
  • select

    Select this element (option, radio)

    $option->select;
    $radio->select;
  • unselect

    Unselect this element (options - multiple select)

    $option->unselect;
  • click

    Clicks this element.

    $link->click;
    $button->click;
  • find($locator)

    Finds and returns an located element under this.

    my $element = $node->find($locator); # search under $node
  • all($locator)

    Finds and returns located elements under this.

    my @elements = $node->all($locator); # search under $node

AUTHOR

NAKAGAWA Masaki <masaki@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Brownie::Driver