Appium
view release on metacpan or search on metacpan
lib/Appium.pm view on Meta::CPAN
my $appium = Appium->new( caps => { app => '/path/to/app.zip' } );
# automatically instantiates Appium::Element for you
my $elem = $appium->find_element('test', 'id');
$elem->click;
=head1 NEW OR UPDATED FUNCTIONALITY
=head2 Contexts
Instead of using windows to manage switching between native
applications and webviews, use the analogous context methods:
my $current = $appium->current_context;
my @contexts = $appium->contexts;
my $context = 'WEBVIEW_1'
$appium->switch_to->context( $context );
=head2 Finding Elements
There are different strategies available for finding elements in
Appium. The options for strategies in a native application are:
id
name
xpath
class|class_name
accessibility_id
ios|ios_uiautomation
android|android_uiautomator
If you're testing a mobile browser like Chrome or Safari, you'll have
access to the same set of finders as in Webdriver:
class
class_name
css
id
link
link_text
name
partial_link_text
tag_name
xpath
Here are some examples of using the Appium specific strategies:
# iOS UIAutomation
$driver->find_element( $locator , 'ios' );
# Android UIAutomator
$driver->find_element( $locator , 'android' );
# iOS accessibility identifier
$driver->find_element( $locator , 'accessibility_id' );
Note that using C<id> as your finding strategy also seems to find
elements by accessibility_id.
If you have Selenium::Remote::Driver v0.24 or later, you'll also have
access to these non-croaking, auto-generated parameter versions of the
finders; see L</Selenium::Remote::Driver/find_element> for more
information. These subs take one argument: the locator for the element
you want, and they'll throw a warning and return C<0> if an element is
not found.
find_element_by_id
find_element_by_name
find_element_by_xpath
find_element_by_class
find_element_by_accessibility_id
find_element_by_ios
find_element_by_android
find_element_by_class
find_element_by_css
find_element_by_id
find_element_by_link
find_element_by_name
find_element_by_partial_link_text
find_element_by_tag_name
find_element_by_xpath
=head1 METHODS
=head2 contexts ()
Returns the contexts within the current session
$appium->contexts;
=head2 current_context ()
Return the current active context for the current session
$appium->current_context;
=head2 switch_to->context ( $context_name )
Switch to the desired context for the current session
$appium->switch_to->context( 'WEBVIEW_1' );
=head2 hide_keyboard( [key_name|key|strategy => $key_or_strategy] )
Hides the software keyboard on the device. In iOS, you have the option
of using C<key_name> to close the keyboard by pressing a specific
key. Or, you can specify a particular strategy; the default strategy
is C<tapOutside>. In Android, no parameters are used.
$appium->hide_keyboard;
$appium->hide_keyboard( key_name => 'Done');
$appium->hide_keyboard( strategy => 'pressKey', key => 'Done');
=head2 app_strings ( [language] )
Get the application strings from the device for the specified
language; it will return English strings by default if the language
argument is omitted.
$appium->app_strings
( run in 3.115 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )