AnyEvent-WebDriver
view release on metacpan or search on metacpan
WebDriver.pm view on Meta::CPAN
"\uE053" "OSRight"
"\uE008" "ShiftLeft"
"\uE050" "ShiftRight"
" " "\uE00D" "Space"
"\uE004" "Tab"
"\uE017" "Delete"
"\uE010" "End"
"\uE002" "Help"
"\uE011" "Home"
"\uE016" "Insert"
"\uE00F" "PageDown"
"\uE00E" "PageUp"
"\uE015" "ArrowDown"
"\uE012" "ArrowLeft"
"\uE014" "ArrowRight"
"\uE013" "ArrowUp"
"\uE00C" "Escape"
"\uE031" "F1"
"\uE032" "F2"
"\uE033" "F3"
"\uE034" "F4"
"\uE035" "F5"
"\uE036" "F6"
"\uE037" "F7"
"\uE038" "F8"
"\uE039" "F9"
"\uE03A" "F10"
"\uE03B" "F11"
"\uE03C" "F12"
"\uE01A" "\uE05C" "Numpad0"
"\uE01B" "\uE056" "Numpad1"
"\uE01C" "\uE05B" "Numpad2"
"\uE01D" "\uE055" "Numpad3"
"\uE01E" "\uE058" "Numpad4"
"\uE01F" "Numpad5"
"\uE020" "\uE05A" "Numpad6"
"\uE021" "\uE057" "Numpad7"
"\uE022" "\uE059" "Numpad8"
"\uE023" "\uE054" "Numpad9"
"\uE025" "NumpadAdd"
"\uE026" "NumpadComma"
"\uE028" "\uE05D" "NumpadDecimal"
"\uE029" "NumpadDivide"
"\uE007" "NumpadEnter"
"\uE024" "NumpadMultiply"
"\uE027" "NumpadSubtract"
"\uE03D" "MetaLeft"
"\uE053" "MetaRight"
EOF
our %SPECIAL_KEY;
sub _special_key($) {
# parse first time
%SPECIAL_KEY || do {
for (split /\n/, $SPECIAL_KEY) {
s/"//g or next;
my ($k, $s, $name) = split /\t/;
# unescape \uXXXX, convert string to codepoint
$_ = /^\\u/ ? hex substr $_, 2 : ord
for $k, $s;
$SPECIAL_KEY{$name} = $k;
$SPECIAL_KEY{"Shift-$name"} = $s if $s;
}
undef $SPECIAL_KEY; # save memory
};
exists $SPECIAL_KEY{$_[0]}
? chr $SPECIAL_KEY{$_[0]}
: Carp::croak "AnyEvent::WebDriver::Actions: special key '$1' not known"
}
sub _kv($) {
$_[0] =~ /^\{(.*)\}$/s
? _special_key $1
: $_[0]
}
sub key_down {
my ($self, $key, $source) = @_;
$self->_add ($source, kbd => keyDown => value => _kv $key)
}
sub key_up {
my ($self, $key, $source) = @_;
$self->_add ($source, kbd => keyUp => value => _kv $key)
}
sub key {
my ($self, $key, $source) = @_;
$self
->key_down ($key, $source)
->key_up ($key)
}
sub type {
my ($self, $string, $source) = @_;
$self->key ($_, $source)
for $string =~ /(\X)/g;
$self
}
=item $al->perform ($wd)
Finalises and compiles the list, if not done yet, and calls C<<
$wd->perform >> with it.
If C<$wd> is undef, and the action list was created using the C<<
$wd->actions >> method, then perform it against that WebDriver object.
There is no underscore variant - call the C<perform_actions_> method with
( run in 0.783 second using v1.01-cache-2.11-cpan-e1769b4cff6 )