Appium Android Automation Starter

Appium Android Automation Starter

Introduction


Appium is an Open-source tool which can be used to automate mobile and desktop applications. Appium supports multiple programming languages like java, python, php etc.


Getting Started....

?As usual every beginners is going to scroll through the net especially YouTube for configuring and writing your first Appium project.

But the thing is it will not be successful. Not with everyone. The main Reason is that the Appium and Android sdk are updating every time so if we scroll through the older tutorials it wont work and we have to sacrifice our valuable time.

Lets see how can we do that?

?What is Needed?


Java should be installed in your Test PC which should be supported by selenium

Install Node.Js to your PC.

Install Android SDk to your PC.

Here Note that as I mentioned earlier the Android sdk is updating day to day so that check in detail the documentation otherwise you will end with an error. For me it was a Folder issue.


Installation

To install Appium in your device follow the command

npm install -g appium

It will install the latest appium in your pc.

After the installation type 'Appium' in cmd to start the appium server.

Running the Java code to Test An Application

Create a Maven project in eclipse IDE(or anything you prefer)

Make sure to add the following dependencies from maven repository

?1.Appium java client

?2.Selenium java Client

Here make sure that the above clients versions are matching with each.

After these actions connect the android device and start appium server(type appium in cmd)

You can run your code from eclipse which will execute the app.

Note : This is Just a Basic information to help with you can find easily about it from the web.

Sample Java program to Open an Application through Appium

package appium_test;

import java.net.MalformedURLException;

import java.net.URL;


import org.openqa.selenium.By;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.remote.DesiredCapabilities;


//import io.appium.java_client.MobileElement;

import io.appium.java_client.android.AndroidDriver;


public class android {

public static AndroidDriver driver;

public static void main(String[] args) throws MalformedURLException, InterruptedException {

DesiredCapabilities cap=new DesiredCapabilities();

cap.setCapability("deviceName","Galaxy");

cap.setCapability("udid", "R9PT30NK0ZB");

cap.setCapability("platformName", "Android");

cap.setCapability("platformVersion", "11");

cap.setCapability("appPackage", "com.mpayror.www");

cap.setCapability("appActivity", "com.mpayror.www.MainActivity");

cap.setCapability("automationName", "UiAUtomator2");

Object packageCap = cap.getCapability("appPackage");

String pack = packageCap.toString();

System.out.println(pack);

URL url = new URL("https://0.0.0.0:4723/wd/hub");

?driver?= new AndroidDriver(url,cap);

?System.out.println("Application Started");

}

要查看或添加评论,请登录

Jithin Somaraj的更多文章

  • How to check all checkboxes on a web page from the browser console.

    How to check all checkboxes on a web page from the browser console.

    Some of us may get frustrated with the large number of checkboxes that need to be clicked to proceed to the next page…

    1 条评论
  • How to Perform Data-Driven Testing in Postman?

    How to Perform Data-Driven Testing in Postman?

    Data-driven testing is a smart way to test software by running tests with different sets of data. Postman, a popular…

  • How To Generate Individual HTML Report in OWASP ZAP

    How To Generate Individual HTML Report in OWASP ZAP

    When scanning multiple APIs simultaneously in OWASP ZAP, many users find it challenging to generate individual API…

    1 条评论
  • How to load external JavaScript file in JMeter

    How to load external JavaScript file in JMeter

    In certain situations, such as during payment processes or when submitting forms within the application, front-end…

    1 条评论
  • How do they Do It ?!!!!

    How do they Do It ?!!!!

    Today I want to share you about how much efforts it takes to hack your device for intruders Because of there is a…

  • How To Set Up Swagger UI editor Locally in Windows

    How To Set Up Swagger UI editor Locally in Windows

    This was one I have searched a lot more but couldn't find a simple answer fortunately I had time to find it out so that…

    7 条评论
  • An Introduction to Kali Linux

    An Introduction to Kali Linux

    Kali Linux is an operating basically an operating system which is based on linux.As per Wikipedia, Kali Linux is a…

  • Different Doors In Apache JMeter

    Different Doors In Apache JMeter

    First of all this is my first ever article in the Linked in community. And I want to inform you that I'm not…

社区洞察

其他会员也浏览了