NAME
Win32::Watir - Perl extension for automating Internet Explorer.
SYNOPSIS
use Win32::Watir;
# Creating new instance of Internet Explorer
my $ie = Win32::Watir::new(
visible => 1,
maximize => 1,
);
# show google, search 'Perl Win32::Watir' keyword.
$ie->goto("http://www.google.co.jp/");
$ie->text_field('name:', "q")->value("Perl Win32::Watir")
DESCRIPTION
Win32::Watir helps you to write tests that are easy to read and easy to maintain.
Watir drives browsers the same way people do. It clicks links, fills in forms, presses buttons. Watir also checks results, such as whether expected text appears on the page.
Win32::Watir is inspired on Ruby/Watir, then fork Win32::IEAutomation.
Win32::IEAutomation special nice interface at perl and windows, but
some method doesn't support IE7, IE8 for Window/Dialog name changes.
Win32::Watir are support IE7, IE8 and use more compatible/like Ruby/Watir
method names, ..etc.
* Ruby/Watir : http://wtr.rubyforge.org/
* Win32::IEAutomation : http://search.cpan.org/perldoc?Win32::IEAutomation
you may require setup Multiple_IE when using this with IE6.0
new - construct.
options are supported to this method in hash format.
warnings => 0 or 1
0: output no warning.
1: output some warnings.
maximize => 0 or 1
0: default window size.
1: maximize IE window when IE start.
visible => 0 or 1
0: IE window invisible.
1: IE window visible.
codepage => undef or 'utf8'
undef: use default codepage at your Windows.
utf8 : use Win32::OLE::CP_UTF8 codepage.
ie (IE executable path) :
specify your multiple IE executable path.
ex) c:/path_to/multipleIE/iexplorer.exe
find :
If "find" key exists, find IE window in
current workspace
if no options specified, use those default.
$ie = new Win32::Watir(
warnings => 0,
maximize => 0,
visible => 1,
codepage => undef,
);
close()
closeIE()
close IE window.
goto(url)
gotoURL(url)
Site navigate to specified URL.
ex). go cpan-site.
$ie->goto('http://search.cpan.org/');
back()
Back()
IE window back. same as "back button" or type Backspace key.
reload()
Reload()
reload, refresh IE page. same as type 'F5' key.
URL()
return current page URL.
title()
Title()
return current page title.
html()
Content()
return current page html.
notice: "CR" code (\r) removed from html.
VerifyText(text, flag)
verify current document include specified "text" .
text : string
flag :
0 (default)
1 (?)
[ToDO] check createTextRange()
PageText()
text()
return current page as Plain TEXT which removed HTML tags.
link(how, value)
getLink(how, value)
Finding hyperlinks.
ex). Using 'linktext:' option (text of the link shown on web page) $ie->getLink('linktext:', "About Google")->Click;
Using 'linktext:' option with pattern matching
$ie->getLink('linktext:', qr/About Google/)->Click;
Using 'id:' option ( <a id=1a class=q href=......>)
$ie->getLink('id:', "1a")->Click;
Using 'href:' option ( <a href=......>)
$ie->getLink('id:', qr/search.cpan.org/)->click;
links()
getAllLinks()
return all array of link_object.
ex). print pagename at google search result.
foreach my $ln ( $ie->getAllLinks ){
print $ln->text."\n" if ($ln->class eq 'l');
}
button(how, what)
getButton(how, what)
finding input buttons.
image(how, what)
getImage(how, what)
finding img.
images()
getAllImages()
return array of all image tag.
radio(how, what)
getRadio(how, what)
return input radio object.
checkbox(how, what)
getCheckbox(how, what)
return input checkbox object.
getTextBox(how, what)
return input (type=text) object.
getTextArea(how, what)
return textarea object.
text_field(how, what)
getAllDivs()
return all array of div tag.
autoit
return AutoItX3.Control
bring_to_front()
make IE window active.
ie_version()
return IE major version (6 or 7 or 8).
register_autoitx_dll(dll_path)
Register specified dll to Server.
arg[0] : dll path.
push_security_alert_yes(wait)
push "Yes" button at "Security Alert" dialog window.
push_confirm_button_ok(title, wait)
type enter key (OK) at JavaScript confirm dialog window.
push_button_yes()
push "Yes" button at JavaScript confirm dialog window.
push_confirm_button_cancel(title, wait)
type escape key (cancel) at JavaScript confirm dialog window.
logon(options)
Enter username, password at Basic Auth dialog window.
options : hash
title : dialog window title.
user : username.
password : username.
ex)
$ie->goto('https://pause.perl.org/pause/authenquery', 1); ## no wait
$ie->logon(
title => "pause.perl.org へ接続",
user => "myname",
password => "mypassword",
);
maximize_ie(title)
maximize specified title window.
arg[0] : window Title name (optional)
delete_cookie()
delete IE cookies.
delete_cache()
delete IE caches.
trim_white_spacs()
return string - trim \s+
_log(string)
private method for testing. use only with t/*.t test.
SEE ALSO
Win32
Win32::OLE
Win32::IEAutomation
AUTHOR
Kazuhito Shimizu, <kazuhito.shimizu@gmail.com>
COPYRIGHT AND LICENSE
same as Win32::IEAutomation..
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 1186:
Non-ASCII character seen before =encoding in 'へ接続",'. Assuming UTF-8