Appium
view release on metacpan or search on metacpan
lib/Appium.pm view on Meta::CPAN
sub current_activity {
my ($self) = @_;
my $res = { command => 'current_activity' };
return $self->_execute_command( $res );
}
sub pull_file {
my ($self, $path) = @_;
croak "Please specify a path to pull from the device"
unless defined $path;
my $res = { command => 'pull_file' };
my $params = { path => $path };
return $self->_execute_command( $res, $params );
}
sub pull_folder {
my ($self, $path) = @_;
croak 'Please specify a folder path to pull'
unless defined $path;
my $res = { command => 'pull_folder' };
my $params = { path => $path };
return $self->_execute_command( $res, $params );
}
sub push_file {
my ($self, $path, $data) = @_;
my $res = { command => 'push_file' };
my $params = {
path => $path,
data => $data
};
return $self->_execute_command( $res, $params );
}
# todo: add better examples of complex find
sub complex_find {
my ($self, @selector) = @_;
croak 'Please specify selection criteria'
unless scalar @selector;
my $res = { command => 'complex_find' };
my $params = { selector => \@selector };
return $self->_execute_command( $res, $params );
}
sub background_app {
my ($self, $seconds) = @_;
my $res = { command => 'background_app' };
my $params = { seconds => $seconds};
return $self->_execute_command( $res, $params );
}
sub is_app_installed {
my ($self, $bundle_id) = @_;
my $res = { command => 'is_app_installed' };
my $params = { bundleId => $bundle_id };
return $self->_execute_command( $res, $params );
}
sub install_app {
my ($self, $app_path) = @_;
my $res = { command => 'install_app' };
my $params = { appPath => $app_path };
return $self->_execute_command( $res, $params );
}
sub remove_app {
my ($self, $app_id) = @_;
my $res = { command => 'remove_app' };
my $params = { appId => $app_id };
return $self->_execute_command( $res, $params );
}
sub launch_app {
my ($self) = @_;
my $res = { command => 'launch_app' };
return $self->_execute_command( $res );
}
sub close_app {
my ($self) = @_;
my $res = { command => 'close_app' };
return $self->_execute_command( $res );
}
sub end_test_coverage {
my ($self, $intent, $path) = @_;
my $res = { command => 'end_test_coverage' };
my $params = {
intent => $intent,
path => $path
};
lib/Appium.pm view on Meta::CPAN
Reset the current application
$appium->reset;
=head2 press_keycode ( keycode, [metastate])
Android only: send a keycode to the device. Valid keycodes can be
found in the L<Android
docs|http://developer.android.com/reference/android/view/KeyEvent.html>.
C<metastate> describes the pressed state of key modifiers such as
META_SHIFT_ON or META_ALT_ON; more information is available in the
Android KeyEvent documentation.
$appium->press_keycode(176);
=head2 long_press_keycode ( keycode, [metastate])
Android only: send a long press keycode to the device. Valid keycodes
can be found in the L<Android
docs|http://developer.android.com/reference/android/view/KeyEvent.html>.
C<metastate> describes the pressed state of key modifiers such as
META_SHIFT_ON or META_ALT_ON; more information is available in the
Android KeyEvent documentation.
$appium->long_press_keycode(176);
=head2 current_activity ()
Get the current activity on the device.
$appium->current_activity;
=head2 pull_file ( $file )
Pull a file from the device, returning it Base64 encoded.
$appium->pull_file( '/tmp/file/to.pull' );
=head2 pull_folder ( $path )
Retrieve a folder at path, returning the folder's contents in a zip
file.
$appium->pull_folder( 'folder' );
=head2 push_file ( $path, $encoded_data )
Puts the data in the file specified by C<path> on the device. The data
must be base64 encoded.
$appium->push_file( '/file/path', $base64_data );
=head2 complex_find ( $selector )
Search for elements in the current application, given an array of
selection criteria.
$appium->complex_find( $selector );
=head2 background_app ( $time_in_seconds )
Defer the application to the background on the device for the
interval, given in seconds.
$appium->background_app( 5 );
=head2 is_app_installed ( $bundle_id )
Check whether the application with the specified C<bundle_id> is
installed on the device.
$appium->is_app_installed( $bundle_id );
=head2 install_app ( $app_path )
Install the desired app on to the device
$appium->install_app( '/path/to/local.app' );
=head2 remove_app( $app_id )
Remove the specified application from the device by app ID.
$appium->remove_app( 'app_id' );
=head2 launch_app ()
Start the application specified in the desired capabilities on the
device.
$appium->launch_app;
=head2 close_app ()
Stop the running application, as specified in the desired
capabilities.
$appium->close_app;
=head2 end_test_coverage ( $intent, $path )
Android only: end the coverage collection and download the specified
C<coverage.ec> file from the device. The file will be returned base 64
encoded.
$appium->end_test_coverage( 'intent', '/path/to/coverage.ec' );
=head2 lock ( $seconds )
Lock the device for a specified number of seconds.
$appium->lock( 5 ); # lock for 5 seconds
=head2 is_locked
Query the device for its locked/unlocked state.
$locked = $appium->is_locked
=head2 shake ()
Shake the device.
$appium->shake;
( run in 2.838 seconds using v1.01-cache-2.11-cpan-f56aa216473 )