AnyEvent-WebDriver

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        select the nth subframe, or an element object.

    $handles = $wd->switch_to_parent_frame
        Switch to the parent frame.

    $rect = $wd->get_window_rect
        Return the current window rect(angle), e.g.:

           $rect = $wd->get_window_rect
           => { height => 1040, width => 540, x => 0, y => 0 }

    $wd->set_window_rect ($rect)
        Sets the window rect(angle), e.g.:

           $wd->set_window_rect ({ width => 780, height => 560 });
           $wd->set_window_rect ({ x => 0, y => 0, width => 780, height => 560 });

    $wd->maximize_window
    $wd->minimize_window
    $wd->fullscreen_window
        Changes the window size by either maximising, minimising or making
        it fullscreen. In my experience, this will timeout if no window
        manager is running.

   ELEMENT RETRIEVAL
    To reduce typing and memory strain, the element finding functions accept
    some shorter and hopefully easier to remember aliases for the standard
    locator strategy values, as follows:

       Alias   Locator Strategy
       css     css selector
       link    link text
       substr  partial link text
       tag     tag name

    $element = $wd->find_element ($locator_strategy, $selector)
        Finds the first element specified by the given selector and returns
        its element object. Raises an error when no element was found.

        Examples showing all standard locator strategies:

           $element = $wd->find_element ("css selector" => "body a");
           $element = $wd->find_element ("link text" => "Click Here For Porn");
           $element = $wd->find_element ("partial link text" => "orn");
           $element = $wd->find_element ("tag name" => "input");
           $element = $wd->find_element ("xpath" => '//input[@type="text"]');
           => e.g. { "element-6066-11e4-a52e-4f735466cecf" => "decddca8-5986-4e1d-8c93-efe952505a5f" }

        Same examples using aliases provided by this module:

           $element = $wd->find_element (css => "body a");
           $element = $wd->find_element (link => "Click Here For Porn");
           $element = $wd->find_element (substr => "orn");
           $element = $wd->find_element (tag => "input");

    $elements = $wd->find_elements ($locator_strategy, $selector)
        As above, but returns an arrayref of all found element objects.

    $element = $wd->find_element_from_element ($element, $locator_strategy,
    $selector)
        Like "find_element", but looks only inside the specified $element.

    $elements = $wd->find_elements_from_element ($element,
    $locator_strategy, $selector)
        Like "find_elements", but looks only inside the specified $element.

           my $head = $wd->find_element ("tag name" => "head");
           my $links = $wd->find_elements_from_element ($head, "tag name", "link");

    $element = $wd->get_active_element
        Returns the active element.

   ELEMENT STATE
    $bool = $wd->is_element_selected
        Returns whether the given input or option element is selected or
        not.

    $string = $wd->get_element_attribute ($element, $name)
        Returns the value of the given attribute.

    $string = $wd->get_element_property ($element, $name)
        Returns the value of the given property.

    $string = $wd->get_element_css_value ($element, $name)
        Returns the value of the given CSS value.

    $string = $wd->get_element_text ($element)
        Returns the (rendered) text content of the given element.

    $string = $wd->get_element_tag_name ($element)
        Returns the tag of the given element.

    $rect = $wd->get_element_rect ($element)
        Returns the element rect(angle) of the given element.

    $bool = $wd->is_element_enabled
        Returns whether the element is enabled or not.

   ELEMENT INTERACTION
    $wd->element_click ($element)
        Clicks the given element.

    $wd->element_clear ($element)
        Clear the contents of the given element.

    $wd->element_send_keys ($element, $text)
        Sends the given text as key events to the given element. Key input
        state can be cleared by embedding "\x{e000}" in $text. Presumably,
        you can embed modifiers using their unicode codepoints, but the
        specification is less than clear to mein this area.

   DOCUMENT HANDLING
    $source = $wd->get_page_source
        Returns the (HTML/XML) page source of the current document.

    $results = $wd->execute_script ($javascript, $args)
        Synchronously execute the given script with given arguments and
        return its results ($args can be "undef" if no arguments are
        wanted/needed).

           $ten = $wd->execute_script ("return arguments[0]+arguments[1]", [3, 7]);

    $results = $wd->execute_async_script ($javascript, $args)
        Similar to "execute_script", but doesn't wait for script to return,
        but instead waits for the script to call its last argument, which is



( run in 1.194 second using v1.01-cache-2.11-cpan-39bf76dae61 )