Mozilla::Mechanize::GUITester is a Perl module that enhances Mozilla::Mechanize with GUI testing.
SYNOPSIS
use Mozilla::Mechanize::GUITester;
# regular Mozilla::Mechanize initialization
my $mech = Mozilla::Mechanize::GUITester->new(%mechanize_args);
$mech->get_url($url);
# convenience wrapper over GetElementById and QueryInterface
my $elem = $mech->get_html_element_by_id("some_id");
# click mouse at the element position + (1, 1)
$mech->x_click($elem, 1, 1);
# play with the mouse relative to the element position
$mech->x_mouse_down($elem, 2, 2);
$mech->x_mouse_move($elem, 4, 4);
$mech->x_mouse_up($elem, 4, 4);
# send keystrokes to the application
$mech->x_send_keys('{DEL}');
# press and release left CTRL button. You can click in the middle.
$mech->x_press_key('LCT');
$mech->x_release_key('LCT');
# run some javascript code and print its result
print $mech->run_js('return "js: " + 2');
# find out element style using its id
print $mech->get_element_style_by_id('the_elem_id', 'background-color');
# are there any javascript errors?
print Dumper($mech->console_messages);
# find out HTTP response status (works only for HTTP protocol)
print $mech->status;
# change some text box by sending keypresses - fires all JS events
my $input = $mech->get_html_element_by_id("tbox", "Input");
$mech->x_change_text($input, "Hi");
This module enhances Mozilla::Mechanize with convenience functions allowing testing of DHTML/JavaScript rich pages.
It uses X11::GUITest to emulate mouse clicking, dragging and moving over elements in DOM tree.
It also allows running of arbitrary javascript code in the page context and getting back the results.
Requirements:
· Perl
Product's homepage
Requirements:
· Perl