Sample Test Script for Android Emulator in Java



Sample Test Script for Android Emulator in Java

package webdriverPackage;
import org.testng.annotations.Test;
import io.appium.java_client.remote.MobileCapabilityType;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
 
public class AndroidTEst {
@Test
public void AndroidEmulatorLaunch() throws MalformedURLException {
RemoteWebDriver driver;
 
//Setting Capabilities
DriverOptions cap = new AppiumOptions(); //Create a object of capabilities
cap.AddAdditionalCapability(MobileCapabilityType.DeviceName, "Samsung Galaxy S9");
cap.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android");
cap.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "8.0.0");
cap.AddAdditionalCapability(MobileCapabilityType.BrowserName, "Chrome");
cap.AddAdditionalCapability(MobileCapabilityType.Udid, "192.168.219.103:5555");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub") ,cap);
driver.get("https://www.Techtutorialz.com");
}
}

 

// POM.XML

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>4.1.2</version>
</dependency>
Tags:
Leave a comment

Your email address will not be published. Required fields are marked *

Subscribe now

Receive weekly newsletter with educational materials, new courses, most popular posts, popular books and much more!

https://bridgejunks.com/ https://crownmakesense.com/ https://brithaniabookjudges.com/ https://hughesroyality.com/ https://rhythmholic.com/ https://bandar89.simnasfikpunhas.com/ https://www.100calshop.co.il/products/thailand/ https://myasociados.com/ https://solyser.com/ http://konfidence.cz/ https://muscadinepdx.com/ https://bandar89.parajesandinos.com.ve/ https://goremekoop.com/ https://oncoswisscenter.com/ https://www.turunclifehotel.com/bandar89/ https://www.houseofproducts.biz/ https://taimoormphotography.com/
BIJI18 BIJI18 BIJI18