Posts

IOS code.

import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.ios.IOSElement; import io.appium.java_client.remote.AutomationName; import io.appium.java_client.remote.MobileCapabilityType; public class First { public static void main(String[] args) throws MalformedURLException { DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6"); cap.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS"); cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST); cap.setCapability(MobileCapabilityType.APP, "//Users/xcodeclub/Desktop/UICatalog.app"); IOSDriver<IOSElement>driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap); driver.manage().timeout

Install and Invoke App.

import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.remote.AndroidMobileCapabilityType; import io.appium.java_client.remote.MobileCapabilityType; public class InstallApp { static AndroidDriver driver; public static void main(String[] args) throws MalformedURLException { // TODO Auto-generated method stub File app = new File("F:/Workspace/Apks", "selendroid-test-app-0.17.0.apk"); DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability(MobileCapabilityType.DEVICE_NAME, "0797818a87d4f5cb"); cap.setCapability(MobileCapabilityType.VERSION, "8.0"); cap.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); cap.setCapability("app"

Udemy: Use of appium in base and derived class

Jar dependencies: Java Client 6.1.0 or 7.0.0 Appium Server 1.9 or 1.10 Selenium 3.141.0 Java jdk version 1.8 commons-lang3-3.7.jar Base Class: --------------------------------------------------- package com.udemy.query; import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.remote.AndroidMobileCapabilityType; import io.appium.java_client.remote.MobileCapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; public class Base { static AndroidDriver<MobileElement> driver; static DesiredCapabilities cap = new DesiredCapabilities(); public static AndroidDriver<MobileElement> setcapabilites() throws MalformedURLException { cap.setCapability(MobileCapabilityType.DEVICE_NAME, "0797818a87d4f5cb"); cap.setCapability(MobileCapability

How to execute appium scripts in could (Saucelabs)

Explanation Coming Soon ... ... ... ---------------------------------------- Sample Code: import io.appium.java_client.AppiumDriver; import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.remote.MobileCapabilityType; import io.appium.java_client.remote.MobilePlatform; import java.io.File; import java.io.InterruptedIOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Set; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.Test; public class SouceLabTest { AndroidDriver driver; @Test public void test() throws MalformedURLException, InterruptedIOException, InterruptedException { DesiredCapabilities caps = DesiredCapabilities.android(); // Soucela

[Android] How to perform parallel testing in Appium using Selenium Grid.

Image
Introduction: We all known that to perform parallel execution of same script in multiple clients we use Selenium Grid.(There is another way using testNG, which will be added in next blog) This works in form of HUB and node architecture. Will have to host one Selenium standalone server and register multiple nodes. Here we will see execution in two real devices. One will be connected via wi-fi and the other one is via USB cable. Required Jar and executables: Appium 1.7.2 (Standalone installation). selenium-server-standalone-X.X.X.jar (This particular tutorial used 3.7.1 version) selenium-java-3.9.1 java client 6.0.0-BETA2 TestNG 6.11. In this tutorial I have used DemoApi app for testing. Steps: Your device should have usb debugging enabled and connected to wifi. Note down the OS version and Android version from each device. To check IP address from Settings >> Wifi >> Advanced >> IP Address  To check OS version of devices from Settings >> Abou