Testing a website on real android phone using Appium

Now I am going to show you how we can launch a website on chrome browser in Android. Note that Appium uses selenium webdriver under the hood to automate the web apps.

To update the webdriver.exe, just download it and put it in below directory. “Appium\node_modules\appium\build\chromedriver\windows”

Here is the sample program for automating the Android web app. If you are familiar with Selenium Webdriver, below code should be a piece of cake for you to understand.

package browsertests;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.Select;

import java.net.URL;
import java.util.concurrent.TimeUnit;

public class LaunchWebsiteOnAndroidPhone
    private WebDriver driver;

    public void loadingSinglePageTest() throws Exception{
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("deviceName", "sagarcell");
        capabilities.setCapability("app", "chrome");
        capabilities.setCapability("browserName", "MobileBrowserType.BROWSER"); 
        capabilities.setCapability("platformVersion", "4.4.4");
        //capabilities.setCapability("browserName", "Chrome");

        driver = new RemoteWebDriver(new URL(""), capabilities) {
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        //quit the browser

You may also like...