MainMenu

Home Java Overview Maven Tutorials

Sunday, 9 April 2017

Automate Android Chrome Browser using Appium



For Video Tutorial : Move on Youtube Channel


Note : Select the playlist as per your need & move with number sequence


For Video : CLICK HERE


First of all connect your device with usb cable
Start appium
write & run the script
Scenarios :
Open the Andriod Chrome Browser
navigate to URL "www.way2testing.com"
Scroll the browser
click the link "appium tutorial with example"

import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
public class Appauto
{
@Test
public void g() throws MalformedURLException, InterruptedException
{
//create object of DesiredCapabilities class
DesiredCapabilities capabilities = DesiredCapabilities.android();
//set the capability to execute test in chrome browser
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
//set the capability of Andriod platform
capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Andriod");
//set the device name
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "7c94b480");
//set the andriod version
capabilities.setCapability(MobileCapabilityType.VERSION, "5.1");
//create object of URL class and specify the appium server address
URL url = new URL("http://127.0.0.1:4723/wd/hub");
WebDriver driver = new AndroidDriver(url, capabilities);
driver.get("http://www.way2testing.com");
Thread.sleep(5000);
JavascriptExecutor js = (JavascriptExecutor) driver;
//Scroll page down to 250px
js.executeScript("window.scrollBy(0,750)", "");
driver.findElement(By.linkText("Appium Tutorials with example")).click();
Thread.sleep(5000);
}
}

6 comments:

  1. Hi there,
    Nice Article I really enjoyed this post Thanks For Sharing,
    Obtain ISO 9001 Certification It enhances your product & service quality, Increases marketing opportunities, Reduces your costs and much more.

    ISO 9001
    ISO 9001 Certification in Mira Road

    ReplyDelete
    Replies
    1. Great Article
      android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Hi there,

    Nice Article I really enjoyed this post Thanks For Sharing, check out this
    Ascent ASSOCIATES is one of Sri Lanka’s leading ‘total solutions’ providers, offering a simple, cost-effective route to ISO Certification in Colombo, Kandy, Galle, Dambulla, Sri Jayawardenepura Kotte & all over Sri Lanka.

    Ascent Associates

    ReplyDelete
  3. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles. Check this out

    ISO 22000 Certification in Mumbai

    ReplyDelete
  4. Hey there,
    Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective, Thanks for Sharing, check this out

    ISO 9001 Certification in Sri Lanka

    ReplyDelete
  5. This said there are sure things that are realized you can do to build your web crawler positioning and traffic to site, there are likewise numerous things you can do to harm your position. dark web links

    ReplyDelete