Appium

 view release on metacpan or  search on metacpan

lib/Appium.pm  view on Meta::CPAN


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
    };

    return $self->_execute_command( $res, $params );
}


sub lock {
    my ($self, $seconds) = @_;

    my $res = { command => 'lock' };
    my $params = { seconds => $seconds };

    return $self->_execute_command( $res, $params );
}


sub is_locked {
    my($self) = @_;

    my $res = { command => 'is_locked' };
    return $self->_execute_command( $res );
}


sub shake {
    my ($self) = @_;

    my $res = { command => 'shake' };
    return $self->_execute_command( $res );
}


sub open_notifications {
    my ($self) = @_;

    my $res = { command => 'open_notifications' };
    return $self->_execute_command( $res );
}


sub network_connection {
    my ($self) = @_;

    my $res = { command => 'network_connection' };
    return $self->_execute_command( $res );
}


sub set_network_connection {
    my ($self, $connection_bitmask) = @_;

    my $res = { command => 'set_network_connection' };
    my $params = {
        parameters => {
            type => $connection_bitmask
        }
    };

    return $self->_execute_command( $res, $params );
}


sub is_android {
    return shift->_type eq 'Android';
}

sub is_ios {
    return shift->_type eq 'iOS';
}



1;

__END__

=pod

=encoding UTF-8

lib/Appium.pm  view on Meta::CPAN


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;

=head2 open_notifications ()

Android only, API level 18 and above: open the notification shade on
Android.

    $appium->open_notifications;

=head2 network_connection ()

Android only: retrieve an integer bitmask that describes the current
network connection configuration. Possible values are listed in
L</set_network_connection>.

    $appium->network_connection;

=head2 set_network_connection ( $connection_type_bitmask )

Android only: set the network connection type according to the
following bitmask:

    # Value (Alias)      | Data | Wifi | Airplane Mode
    # -------------------------------------------------
    # 0 (None)           | 0    | 0    | 0
    # 1 (Airplane Mode)  | 0    | 0    | 1
    # 2 (Wifi only)      | 0    | 1    | 0
    # 4 (Data only)      | 1    | 0    | 0
    # 6 (All network on) | 1    | 1    | 0

    $appium->set_network_connection(6);

=head2 tap ( $x, $y )

Perform a precise tap. See L<Appium::TouchActions/tap> for more
information.

    $appium->tap( 0.5, 0.5 );

=head2 page

Display a quick summary of all interesting elements on the current
view. See L<Appium::Android::CanPage> for more information about the
Android implementation, and L<Appium::Ios::CanPage> for the iOS
implementation.

=head1 SEE ALSO

Please see those modules/websites for more information related to this module.

=over 4

=item *

L<Appium::Element|Appium::Element>



( run in 0.512 second using v1.01-cache-2.11-cpan-df04353d9ac )