Showing posts with label webdriver tutorials. Show all posts
Showing posts with label webdriver tutorials. Show all posts

Thursday, September 6, 2018

Share/Mirror Android Holler Upwards Covert To Pc Using Androidscreencast

Share/Mirror Android Holler Upwards Covert To Pc Using Androidscreencast

There are many unlike software available using which you lot tin forcefulness out share your android mobile device covert alongside your PC or laptop. androidscreencast software Is i of them to control an android device remotely. Using androidscreencast desktop software app, You tin forcefulness out mirror your android device's covert In your PC as well as besides you lot tin forcefulness out record the android device's covert activeness video In your PC. Let's larn how to Install as well as use Androidscreencast software to tape video of android mobile device's screen activity. We volition role It In android app automation using appium.

PREREQUISITES :
  1. Java 5 or afterward version should hold upwards Installed In your PC. View JAVA/JDK INSTALLATION steps.
  2. Android SDK should hold upwards Installed In your PC. View SDK INSTALLATION steps.
  3. Android device should hold upwards connected alongside PC and detected using "adb devices" command In command prompt. View ANDROID DEVICE CONNECTION steps.
Download Androidscreencast JNLP
We need androidscreencast.jnlp file to launch androidscreencast software Interface. You tin forcefulness out download It from THIS PAGE or role this straight download LINK. It volition download androidscreencast.jnlp file. Put It In your desired PC movement location. I convey set It at E:\JNLP location.

Add Java Exception Site List
You require to add together bellow given URLs In Java Exception Site List.

URLs to add together In Java Exception Site List
  1. http://code.google.com
  2. http://androidscreencast.googlecode.com
To add together higher upwards URLs In Java exception site list,
  • Click On Windows Start button.
  • Click On Java.
  • Click On Configure Java. It volition opened upwards Java Control Panel dialog.
  • On Java Control Panel dialog, Select Security tab.
  • Click On Edit Site List push clitoris on Security tab. It volition opened upwards Exception Site List dialog.
  • Add higher upwards URLs i past times i In listing of Exception Site List dialog past times clicking on Add button.
  • Click on OK push clitoris of Exception Site List dialog.
  • Click on OK push clitoris of Java Control Panel dialog.
Steps alongside Image description are equally bellow.
 There are many unlike software available using which you lot tin forcefulness out  Share/Mirror Android Phone Screen To PC Using Androidscreencast

Launch Androidscreencast Interface
For launching androidscreencast Interface,
  • Open JNLP folder where androidscreencast.jnlp file Is located.
  • Press keyboard's CTRL + Shift + Mouse Right Click. It volition opened upwards correct click context bill of fare equally shown In bellow given Image.
 There are many unlike software available using which you lot tin forcefulness out  Share/Mirror Android Phone Screen To PC Using Androidscreencast
  • Select "Open command window here" from context menu. It volition launch command prompt alongside navigation to electrical flow selected JNLP folder.
 There are many unlike software available using which you lot tin forcefulness out  Share/Mirror Android Phone Screen To PC Using Androidscreencast
  • Type command javaws androidscreencast.jnlp In command prompt as well as press keyboard ENTER button. It volition present you lot dialog equally bellow on start run.
  • Select banking concern jibe box as well as click on Run push clitoris equally shown In higher upwards Image.
  • It volition launch Androidscreencast as well as present your connected device's covert equally shown In bellow Image.

Now whatever you lot exercise In your mobile screen, It volition display In Androidscreencast Interface.

Record Android Screen Video Using Androidscreencast Interface
Now you lot tin forcefulness out tape your android telephone screen's video using androidscreencast Interface software. To tape video,
  • Click on Record button equally shown In bellow Image. It volition opened upwards Save file dialog.

 There are many unlike software available using which you lot tin forcefulness out  Share/Mirror Android Phone Screen To PC Using Androidscreencast
  • Select your desired place to salve recording video file, Provide file advert as well as click on Save button.
  • It volition start recording your mobile devices covert activities.
  • To cease recording, Once i time to a greater extent than click on Record button. It volition cease covert recording.
  • It volition exercise .mov file at your selected location.
This agency you lot tin forcefulness out mirror your android mobile's covert In PC as well as tape video of covert activities using Androidscreencast software.
no image

Record Appium Exam Execution Video For Android App

Appium software examination execution video recording Is required when yous are executing real large tests as well as perform multitasking. Recording android device's covert video during software automation testing tin flame helps yous to detect out when Issue occurred as well as what are the steps to reproduce Issue. You tin flame Identify why your software examination Is failing past times looking In to video recording.

Before learning how to tape video of android software app automation test execution using appium, You must know how to mirror your android device's covert In PC using androidscreencast equally described In my PREVIOUS POST. Android mobile's covert sharing amongst PC Is required to tape video of android app automation examination execution. Using androidscreencast, We tin flame portion mobile covert amongst PC as well as and therefore nosotros tin flame tape PC screen's video. Let acquire how to Do It.

PREREQUISITE : Android device should hold upward connected wit PC as well as Android mobile's covert should hold upward shared amongst PC using androidscreencast.

App To Use as well as Aim To Achieve
This Is non app specific software examination example therefore yous tin flame purpose whatever app. We volition purpose hither API Demos android software app of android. Here nosotros wants to capture covert of PC therefore that nosotros tin flame tape activities of androidscreencast. We volition use ATUTestRecorder to tape video of your PC screen. In short, We volition purpose androidscreencast and ATUTestRecorder to tape video of android device's covert activities during appium examination execution.

Add ATUTestRecorder Jar In Project's Build Path
For recording your PC's covert video, You demand to download ATUTestRecorder_2.1.jar file from THIS PAGE and add together It In your project's laid upward path. View THIS POST to acquire how to add together external jolt files In project's laid upward path.

Create Test
Create novel examination file VideoReord.Java In your eclipse's projection as well as purpose bellow given examination script In It.

VideoReord.Java
package Android;  import io.appium.java_client.android.AndroidDriver;  import java.io.IOException; import java.net.URL; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.TimeUnit; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecuteResultHandler; import org.apache.commons.exec.DefaultExecutor; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import atu.testrecorder.ATUTestRecorder; import atu.testrecorder.exceptions.ATUTestRecorderException;  world degree VideoReord {  static AndroidDriver driver;  // Set path of your node.exe file. Set your path.  // Progra 1 represents Program Files folder.  String nodePath = "C:/Progra 1/Appium/node.exe";  // Set path of your appium.js file. Set your path.  String appiumJSPath = "C:/Progra 1/Appium/node_modules/appium/bin/appium.js";   ATUTestRecorder recorder;   @BeforeTest  world void setUp() throws Exception {   // Start appium server.   appiumStart();    // Get electrical flow appointment as well as fourth dimension to supply inwards recorded video name.   DateFormat dateFormat = novel SimpleDateFormat("yy-MM-dd HH-mm-ss");   Date appointment = novel Date();   // Created object of ATUTestRecorder.   // Provide path to shop videos as well as file refer format.   recorder = novel ATUTestRecorder("D:\\ScriptVideos\\", "TestVideo-" + dateFormat.format(date), false);    DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity", "io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);    // To outset video recording of your PC screen.   recorder.start();  }   @Test  world void performOrientation() throws InterruptedException {   // Get as well as impress electrical flow covert orientation.   System.out.println("*--*--*-- Current covert orientation Is : " + driver.getOrientation());   System.out.println("*--*--*-- Changing covert Orientation to LANDSCAPE.");   // Changing covert Orientation to LANDSCAPE.   driver.rotate(org.openqa.selenium.ScreenOrientation.LANDSCAPE);   // Get as well as impress covert orientation afterwards changing It.   System.out.println("*--*--*-- Now covert orientation Is : " + driver.getOrientation());   Thread.sleep(5000);   // Scroll till chemical cistron which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   System.out.println("*--*--*-- Changing covert Orientation to PORTRAIT.");   // Changing covert Orientation to PORTRAIT.   driver.rotate(org.openqa.selenium.ScreenOrientation.PORTRAIT);   // Get as well as impress covert orientation afterwards changing It.   System.out.println("*--*--*-- Now covert orientation Is : " + driver.getOrientation());   Thread.sleep(5000);  }   @AfterTest  world void End() throws IOException, ATUTestRecorderException {   driver.quit();   // Stop appium server when examination Is ended.   appiumStop();   // Stop video recording.   recorder.stop();  }   // This method Is responsible for starting appium server.  world void appiumStart() throws IOException, InterruptedException {   // Created object of apache CommandLine class.   // It volition outset ascendancy prompt In background.   CommandLine ascendancy = novel CommandLine("cmd");   // Add unlike arguments In ascendancy business which requires to outset appium server.   command.addArgument("/c");   command.addArgument(nodePath);   command.addArgument(appiumJSPath);   // Set Server address.   command.addArgument("--address");   command.addArgument("127.0.0.1");   // Set Port.   command.addArgument("--port");   command.addArgument("4723");   command.addArgument("--no-reset");   command.addArgument("--log");   // Set path to shop appium server log file.   command.addArgument("D://appiumLogs.txt");   // Execute ascendancy business arguments to outset appium server.   DefaultExecuteResultHandler resultHandler = novel DefaultExecuteResultHandler();   DefaultExecutor executor = novel DefaultExecutor();   executor.setExitValue(1);   executor.execute(command, resultHandler);   // Wait for xv minutes therefore that appium server tin flame outset properly earlier going for examination execution.   // Increase this fourth dimension If confront whatever error.   Thread.sleep(15000);  }   // This method Is responsible for stopping appium server.  world static void appiumStop() throws IOException {   // Add unlike arguments In ascendancy business which requires to halt appium server.   CommandLine ascendancy = novel CommandLine("cmd");   command.addArgument("/c");   command.addArgument("taskkill");   command.addArgument("/F");   command.addArgument("/IM");   command.addArgument("node.exe");   // Execute ascendancy business arguments to halt appium server.   DefaultExecuteResultHandler resultHandler = novel DefaultExecuteResultHandler();   DefaultExecutor executor = novel DefaultExecutor();   executor.setExitValue(1);   executor.execute(command, resultHandler);  } }
Test Decription
  • We accept used appiumStart() as well as appiumStop() methods to outset as well as halt appium. So appium volition hold upward started automatically wehn yous run your examination as well as yous non demand to outset as well as halt appium manually.
  • Another affair nosotros accept Implemented In script Is video recording of PC covert using ATUTestRecorder. You tin flame alter path to shop recorded video as well as video file refer equally per your requirement.
Running Test

When yous run inwards a higher house software examination using testng, Immediately keep androidscreencast Interface on transcend of the screen. Otherwise androidscreencast Interface's covert activities non recorded In video. So when your examination started execution, All the android mobile screen's activities volition display on your PC covert as well as ATUTestRecorder volition tape your PC screen.

This agency yous tin flame tape appium software examination execution video for whatever android app.

Wednesday, September 5, 2018

Appium Android : Verify Chemical Component Introduce Or Non On App's Screen

Appium Android : Verify Chemical Component Introduce Or Non On App's Screen

In android automation test, Sometimes you lot bespeak to verify if chemical cistron is acquaint or not on native  software app's covert earlier taking some action. Example : You wants to click on push exclusively if another chemical cistron is acquaint on covert of software app. You volition facial expression upward this sort of province of affairs as well as you lot convey to detect out how to verify chemical cistron is acquaint or non on page. There is non whatever built inwards constituent inwards selenium to cheque if chemical cistron is acquaint or non on page of software app. So nosotros bespeak to find-out some function to a greater extent than or less which tin sack help us to check if chemical cistron is acquaint or non on page.

Here I convey prepared real uncomplicated illustration which tin sack demonstrate you lot how to cheque if chemical cistron is acquaint or non on covert of android app when running android appium software automation test. Earlier i convey described how to verify chemical cistron is acquaint or non on webpage inwards THIS POST.

App To Use
We volition purpose API Demos app inwards this illustration to cheque if chemical cistron is acquaint or non on android software app's screen. View THIS PAGE to download API Demos app.

Aim To Achieve
On API Demos app's abode screen, We wants to verify that elements amongst text "App" as well as "Loader" are acquaint or not. We volition purpose 2 separate @Test methods to verify each chemical cistron as well as pass/fail specific exam method based on availability of chemical cistron on screen.

 You wants to click on push exclusively if another chemical cistron is acquaint on covert of software  Appium Android : Verify Element Present or Not On App's Screen

As you lot tin sack run across inwards to a higher house image, We volition live on able to detect chemical cistron containing "App" text equally it is acquaint on screen. But it volition live on unable to detect chemical cistron containing "Loader" text equally it is non acquaint on screen.

How To Do It
Selenium has findElements method to give-up the ghost all elements from page using given id or cite or xpath etc. We volition use findElementsByName equally bellow to give-up the ghost listing of elements from page which contains cite = App or Loader.

//There is chemical cistron amongst cite App on screen. //So iselementpresent volition live on laid to true. Boolean iselementpresent = driver.findElementsByName("App").size() != 0;    //There is non whatever chemical cistron similar Loader on screen. //So iselementpresent volition live on laid to false. Boolean iselementpresent = driver.findElementsByName("Loader").size() != 0;

It volition give-up the ghost the listing of elements for given cite as well as and hence cheque the size. It volition laid iselementpresent = true(means chemical cistron is present) if size is non equals to 0 as well as laid iselementpresent = false(means chemical cistron is non present) if size is equals to 0.

Create And Run Test
Run bellow given software automation exam inwards your eclipse as well as verify how it works. If you lot don't know how to run android appium exam as well as hence you lot bespeak to refer appium tutorials listed on THIS PAGE.

CheckElementPresent.java
package Android;  import io.appium.java_client.android.AndroidDriver;  import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecuteResultHandler; import org.apache.commons.exec.DefaultExecutor; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.Assert; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  world cast CheckElementPresent {  AndroidDriver driver;   @BeforeTest  world void setUp() throws MalformedURLException {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity", "io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   //Check chemical cistron App is acquaint or non on page.  @Test  world void checkAppElementPresent() {   //There is chemical cistron amongst cite App on screen.   //So iselementpresent volition live on laid to true.   Boolean iselementpresent = driver.findElementsByName("App").size() != 0;   //iselementpresent volition live on truthful hence assertion volition overstep as well as hence exam method volition overstep too.   Assert.assertTrue(iselementpresent,"Targeted chemical cistron App is non acquaint on screen");   System.out.println("Targeted chemical cistron App is acquaint on screen.");  }   //Check chemical cistron Loader is acquaint or non on page.  @Test  world void checkLoaderElementPresent() {   //There is non whatever chemical cistron similar Loader on screen.   //So iselementpresent volition live on laid to false.   Boolean iselementpresent = driver.findElementsByName("Loader").size() != 0;   //iselementpresent volition live on fake hence assertion volition neglect as well as hence exam method volition neglect too.   Assert.assertTrue(iselementpresent,"Targeted chemical cistron Loader is non acquaint on screen");   System.out.println("Targeted chemical cistron Loader is acquaint on screen.");  }   @AfterTest  world void End() throws IOException {   driver.quit();    } }

When you lot run to a higher house test, It volition exhibit you lot consequence similar bellow inwards eclipse.
 You wants to click on push exclusively if another chemical cistron is acquaint on covert of software  Appium Android : Verify Element Present or Not On App's Screen
  • checkAppElementPresent() method is overstep as elements amongst cite "App" is acquaint on android app's screen.
  • checkLoaderElementPresent() method is neglect as elements amongst cite "Loader" is non acquaint on android app's screen.
Also you lot tin sack purpose whatever other methods like findElementsByXPath, findElementsByAccessibilityId, findElementsByClassName, etc to give-up the ghost the listing of elements using given criteria.
Appium : Tap On Switch Push Of Android App To On/Off

Appium : Tap On Switch Push Of Android App To On/Off

In android, There is 1 of import chemical ingredient ON/OFF switch. It is real slowly to ON/OFF switch inwards android automation test using appium but you lot should know how to produce it. In this article, I am going to described you lot how to ON/OFF switch inwards appium android automation test using tap(int fingers, int duration) method of MobileElement class. Also you lot tin dismiss purpose click() method to tap on push clit but hither nosotros volition purpose tap method for your understanding.

App To Use
We volition purpose API Demos app inwards this test. You tin dismiss download it from google play.

Aim Of Test
In this appium automation test, We wants to tap on Monitored switch "OFF" push clit to switch "ON" it too thence 1 time once again tap on Monitored switch "ON" push clit to switch "OFF" it equally shown inwards bellow image. Also nosotros wants to verify that switch is ON or OFF before taping on it.


In API Demos app, You tin dismiss manually navigate to inwards a higher house concealment from App Home -> Views -> Switches.

Create And Run Test
Create bellow given examination inwards eclipse too run it. View before published APPIUM TUTORIALS if you lot don't know how to run appium test.

TapOnSwitch.java
package Android;  import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  world degree TapOnSwitch {  AndroidDriver driver;   @BeforeTest  world void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity", "io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  world void tapSwitchOnOff() throws InterruptedException {   // Scroll till chemical ingredient which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical ingredient which contains "Switches" text If It Is non visible on screen.   driver.scrollTo("Switches");   // Click on Switches.   driver.findElement(By.name("Switches")).click();      //Get condition of switch using it's text.   String switchStatus1 = driver.findElementById("io.appium.android.apis:id/monitored_switch").getText();   System.out.println(switchStatus1);   //If switchStatus1 = Monitored switch OFF, Execute inner code.   if((switchStatus1.trim()).equals("Monitored switch OFF")){    System.out.println("Doing Monitored switch ON");    //Locate switch push clit chemical ingredient yesteryear mention = Monitored switch OFF.    MobileElement swt = (MobileElement) driver.findElementByName("Monitored switch OFF");    //Tap on switch push clit "Monitored switch OFF" to arrive ON.    swt.tap(1, 1);    System.out.println("Monitored switch is ON now.");   }   //Pause examination for five seconds to seat switch ON for five seconds.   Thread.sleep(5000);      //Get condition of switch using it's text.   String switchStatus2 = driver.findElementById("io.appium.android.apis:id/monitored_switch").getText();   System.out.println(switchStatus2);   //If switchStatus1 = Monitored switch ON, Execute inner code.   if((switchStatus2.trim()).equals("Monitored switch ON")){    System.out.println("Doing Monitored switch OFF");    //Locate switch push clit chemical ingredient yesteryear mention = Monitored switch ON.    MobileElement swt = (MobileElement) driver.findElementByName("Monitored switch ON");    //Tap on switch push clit "Monitored switch OFF" to arrive OFF.    swt.tap(1, 1);    System.out.println("Monitored switch is OFF now.");   }  }    @AfterTest  world void End() {   driver.quit();  } }

When you lot run inwards a higher house test,
  • It volition open API Demos app inwards android device.
  • Navigate to Switches screen.
  • Tap on Monitored switch to switch it ON from OFF.
  • Once 1 time again tap on Monitored switch to switch it OFF from ON.
This means you lot tin dismiss tap on whatsoever switch of android using tap method of MobileElement class.
Appium Tutorial - Type Inwards Text Box Of Android App

Appium Tutorial - Type Inwards Text Box Of Android App

Text box is really mutual chemical component division of whatever android native software app or software spider web application. In android appium software automation test, If y'all wants to type text inward text box of android app as well as hence y'all tin strength out role sendKeys(keysToSend) ascendance of selenium WebElement interface. Let's await at illustration to larn how to type inward text box of android app.

App To Use And Aim Of Test
We volition role API Demos software app inward this exam to larn how to type inward textbox of android application. 

 Text box is really mutual chemical component division of whatever android native software app or software spider web applic Appium Tutorial - Type In Text Box Of Android App

Above enshroud display text box. We volition role this text box to type text inward android appium software test. You tin strength out navigate to to a higher house enshroud from API Demos app's Home -> Views -> Controls -> 2. Dark Theme.

Create as well as hold upwards software test
Create bellow given exam inward eclipse as well as hold upwards it using testng as well as appium as well as divulge exam execution inward your android mobile screen.

TypeInTextBox.java
package Android;  import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  world degree TypeInTextBox {  AndroidDriver driver;   @BeforeTest  world void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  world void typeInText() throws InterruptedException {   // Scroll till chemical component division which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical component division which contains "Controls" text If It Is non visible on screen.   driver.scrollTo("Controls");   // Click on Controls.   driver.findElement(By.name("Controls")).click();   // Scroll till chemical component division which contains "2. Dark Theme" text If It Is non visible on screen.   driver.scrollTo("2. Dark Theme");   // Click on 2. Dark Theme.   driver.findElement(By.name("2. Dark Theme")).click();   // Typing inward text box using sendKeys command.   driver.findElement(By.id("io.appium.android.apis:id/edit")).sendKeys("Test");  }   @AfterTest  world void End() {   driver.quit();  } }

Last disputation of text method volition type text "Test" inward textbox of API Demos android app.

This means y'all tin strength out use sendKeys(keysToSend) ascendance to type text inward whatever text box of android software  application.

Tuesday, September 4, 2018

Appium : Pick Out Check-Box Of Android App

Appium : Pick Out Check-Box Of Android App

Check box is to a greater extent than or less other mutual chemical cistron of whatsoever native, hybrid or mobile software spider web applications. Selecting banking venture correspond box of android software app inwards appium exam is really slow chore in addition to I hope, most of yous already knows how to select android app's banking venture correspond box inwards appium automation exam but i cause got to mean value well-nigh bottom flat learner who don't know how to select android app's check box inwards appium automation software test. Let's cause got really elementary representative to larn how to direct banking venture correspond box inwards appium. We tin flaming role click() method to direct banking venture correspond box.
Do yous wants to larn all appium tutorials? View this LINK.

App To Use And Aim To Achieve In Software Test 
We volition role same API Demos software app of android to larn how to direct banking venture correspond box of android app every bit shown inwards bellow image.

 Check box is to a greater extent than or less other mutual chemical cistron of whatsoever native Appium : Select Check-box Of Android App

Manually yous tin flaming navigate to higher upward covert from API Demos app's Home -> Views -> Controls -> 2. Dark Theme.

Create And Run Test
Create bellow given exam inwards eclipse in addition to run it using testng in addition to appium. Observe exam execution inwards android device.

SelectingCheckBox.java
package Android;  import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  populace degree SelectingCheckBox {  AndroidDriver driver;   @BeforeTest  populace void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  populace void select() throws InterruptedException {   // Scroll till chemical cistron which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical cistron which contains "Controls" text If It Is non visible on screen.   driver.scrollTo("Controls");   // Click on Controls.   driver.findElement(By.name("Controls")).click();   // Scroll till chemical cistron which contains "2. Dark Theme" text If It Is non visible on screen.   driver.scrollTo("2. Dark Theme");   // Click on 2. Dark Theme.   driver.findElement(By.name("2. Dark Theme")).click();   // Click on check-box to direct it.   driver.findElement(By.name("Checkbox 2")).click();  }   @AfterTest  populace void End() {   driver.quit();  } }

Last syntax in @Test method volition direct the banking venture correspond box using .click() method when yous run software test.
Appium - Enshroud Android Keyboard During Test

Appium - Enshroud Android Keyboard During Test

Hiding keyboard inward android device is 1 of the mutual action. In your android mobile device, It volition exhibit y'all soft keyboard on cover automatically when y'all type text inward text box of software app therefore it volition shroud around of the elements. Now supposing y'all wants to lead value from drib downward which is hidden behind android keyboard. For that, You withdraw to hide android keyboard showtime therefore that y'all tin come across drib downward in addition to and therefore y'all tin lead value from it. In android appium software automation test, It is real slow to hide android keyboard using hideKeyboard() method of AndroidDriver. Let's acquire how to hide android keyboard inward appium software automation test.

App To Use And Aim Of Test
We volition role same API Demos software app In this keyboard hiding test. Main aim of this appium software automation examination is to shroud android soft keyboard afterwards typing text inward text box every bit shown inward bellow image.

 inward android device is 1 of the mutual activeness Appium - Hide Android Keyboard During Test

Manually y'all tin sentiment inward a higher house cover inward API Demos software app from API Demos app's Home -> Views -> Controls -> 2. Dark Theme.

Create And Run Test
Create bellow given Keyboard hiding appium examination eclipse.

SelectDropDownValue.java
package Android;  import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  populace flat SelectDropDownValue {  AndroidDriver driver;   @BeforeTest  populace void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  populace void select() throws InterruptedException {   // Scroll till chemical part which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical part which contains "Controls" text If It Is non visible on screen.   driver.scrollTo("Controls");   // Click on Controls.   driver.findElement(By.name("Controls")).click();   // Scroll till chemical part which contains "2. Dark Theme" text If It Is non visible on screen.   driver.scrollTo("2. Dark Theme");   // Click on 2. Dark Theme.   driver.findElement(By.name("2. Dark Theme")).click();   // Typing inward text box using sendKeys command.   driver.findElement(By.id("io.appium.android.apis:id/edit")).sendKeys("Test");   //To shroud keyboard.    driver.hideKeyboard();  }   @AfterTest  populace void End() {   driver.quit();  } }

Run inward a higher house examination inward eclipse using testng in addition to appium. Last syntax of @Test method volition shroud android keyboard.

This agency y'all tin shroud keyboard of android device inward appium android software automation testing.

Appium - Choose Especial From Driblet Downwards Of Android App

Appium - Choose Especial From Driblet Downwards Of Android App

Selecting item/value from drib downward is needed inward android software app equally nearly of the apps comprise drib down. Earlier nosotros learnt how to choose value from spinner inward android appium software exam which is opening inward straight listing inward THIS POST. Now let's meet about other event of how to choose value from drib downward listing which is opening inward popup.

App To Use And Aim Of Test
We volition role API Demos software app inward this drib downward exceptional pick test. Our brain aim is to click on drib downward to opened upwards items listing popup as well as and thence selecting 1 exceptional from listing equally shown inward bellow image.

value from drib downward is needed inward android software app equally nearly of the apps comprise drib create Appium - Select Item From Drop Down Of Android App

You tin persuasion higher upwards covert from API Demos software app's Home -> Views -> Controls -> 2. Dark Theme. -> Tap on Drop Down.

Create And Run Test
I accept created real uncomplicated appium android drib downward exceptional pick software automation test. Create bellow given exam inward eclipse.

SelectValueDropDown.java
package Android;  import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  world class SelectValueDropDown {  AndroidDriver driver;   @BeforeTest  world void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  world void select() throws InterruptedException {   // Scroll till chemical ingredient which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical ingredient which contains "Controls" text If It Is non visible on screen.   driver.scrollTo("Controls");   // Click on Controls.   driver.findElement(By.name("Controls")).click();   // Scroll till chemical ingredient which contains "2. Dark Theme" text If It Is non visible on screen.   driver.scrollTo("2. Dark Theme");   // Click on 2. Dark Theme.   driver.findElement(By.name("2. Dark Theme")).click();   // Typing inward text box using sendKeys command.   driver.findElement(By.id("io.appium.android.apis:id/edit")).sendKeys("Test");   //To shroud keyboard    driver.hideKeyboard();   //Click on dropdown to opened upwards list.   driver.findElement(By.id("android:id/text1")).click();   //Select exceptional "Mars" from drib downward list.   driver.findElement(By.name("Mars")).click();     }   @AfterTest  world void End() {   driver.quit();  } }

Run higher upwards exam inward eclipse using appium as well as testng as well as notice exam execution. Last syntax volition choose exceptional "Mars" from listing items.

This agency you lot tin choose value from android software app's drib downward listing inward appium test.
Appium Tutorials - Think Driblet Downward Values Listing Of Android App

Appium Tutorials - Think Driblet Downward Values Listing Of Android App

Retrieving all values from drib downwards listing of android app software inwards appium software automation exam is fiddling tricky business but non hard. You tin sentiment how to SELECT VALUE from drib downwards list's popup inwards appium test. We tin use findElements() method of selenium webdriver to locate in addition to instruct all values from drib downwards list.

Aim Of Test And App To Use
Our primary aim is to shop all values from drib downwards listing of android software application. We volition purpose API Demos app inwards this android software automation test.


Manually yous tin sentiment higher upwards covert from API Demos app's Home -> Views -> Controls -> 2. Dark Theme. -> Tap on Drop Down.

Create And Run Test
Created really uncomplicated software automation exam to instruct all values from drib downwards of android application.

GetDropDownList.java
package Android;  import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver;  import java.net.URL; import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  populace shape GetDropDownList {  AndroidDriver driver;   @BeforeTest  populace void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  populace void select() throws InterruptedException {   // Scroll till chemical gene which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical gene which contains "Controls" text If It Is non visible on screen.   driver.scrollTo("Controls");   // Click on Controls.   driver.findElement(By.name("Controls")).click();   // Scroll till chemical gene which contains "2. Dark Theme" text If It Is non visible on screen.   driver.scrollTo("2. Dark Theme");   // Click on 2. Dark Theme.   driver.findElement(By.name("2. Dark Theme")).click();   // Typing inwards text box using sendKeys command.   driver.findElement(By.id("io.appium.android.apis:id/edit")).sendKeys("Test");   //To cover keyboard    driver.hideKeyboard();   //Click on dropdown to opened upwards list.   driver.findElement(By.id("android:id/text1")).click();   //Locate all drib downwards listing elements    List dropList = driver.findElements(By.id("android:id/text1"));   //Extract text from each chemical gene of drib downwards listing 1 yesteryear one.     for(int i=0; i< dropList.size(); i++){    MobileElement listItem = (MobileElement) dropList.get(i);       System.out.println(listItem.getText());   }    }   @AfterTest  populace void End() {   driver.quit();  } }

Run higher upwards android software automation exam using appium to come across how to instruct all values from drib downwards list. It volition impress all values inwards console.

Monday, September 3, 2018

Appium Tutorials - Pick Out Radio Push Clit Of Android App

Appium Tutorials - Pick Out Radio Push Clit Of Android App

Selecting radio push clit of android software app inward appium automation exam is same activity every bit selecting check-box every bit described inward my Earlier article. Only deviation betwixt check-box pick in addition to radio push clit pick is you lot tin hand the axe pick out solely i radio push clit at a fourth dimension from given listing of radio buttons but you lot tin hand the axe pick out all check-box from given list. So it is slow to pick out radio push clit of whatsoever android software app using appium automation test. Let's accept unproblematic illustration to empathise how to pick out radio push clit of android app In appium software automation test.

App To Use And Aim To Achieve In Appium Test
We volition role API Demos app In this appium software automation exam to larn how to pick out radio push clit of android app every bit shown inward bellow given screenshot.

 Selecting radio push clit of android software app inward appium automation exam is same activity a Appium Tutorials - Select Radio Button Of Android App

Manually you lot tin hand the axe acquire to higher upward covert from API Demos app's Home -> Views -> Controls -> 2. Dark Theme.

Create And Run Test
Create in addition to bellow given radio push clit pick appium exam inward eclipse.

SelectingRadioButton.java
package Android;  import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  world class SelectingRadioButton {  AndroidDriver driver;   @BeforeTest  world void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  world void select() throws InterruptedException {   // Scroll till chemical part which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical part which contains "Controls" text If It Is non visible on screen.   driver.scrollTo("Controls");   // Click on Controls.   driver.findElement(By.name("Controls")).click();   // Scroll till chemical part which contains "2. Dark Theme" text If It Is non visible on screen.   driver.scrollTo("2. Dark Theme");   // Click on 2. Dark Theme.   driver.findElement(By.name("2. Dark Theme")).click();   // Click on RadioButton ii to pick out it.   driver.findElement(By.name("RadioButton 2")).click();  }   @AfterTest  world void End() {   driver.quit();  } }

Run higher upward exam inward eclipse using testng in addition to appium in addition to uncovering execution inward android mobile screen. Last syntax in @Test method volition pick out radio button.

This means you lot tin hand the axe pick out radio push clit of whatsoever android app using appium software automation test.
Appium Android - Develop Star Rating Bar Example

Appium Android - Develop Star Rating Bar Example

Automating star rating bar inwards appium android software bear witness is rattling easy, There volition move star rating bar inwards many android software applications. Generally star rating bar is used to charge per unit of measurement products, services inwards eCommerce android software applications. Mostly yous volition run across 3 star too 5 star rating bars inwards such android software applications. If yous wants to automate star ratings inwards appium android bear witness therefore it is picayune tricky but rattling tardily too nosotros tin produce it using TouchAction class. Let's run across how tin nosotros automate 3 star too 5 star rating bars of android software application using appium alongside example.

Aim Of Test And App To Use
We wants to automate 3 star too 5 star rating bars inwards android appium automation test. We volition move API Demos app to automate star ratings. 

As yous tin run across inwards bellow image, We wants to give i star on 3 star rating bar too iv star on 5 star rating bar.


In API Demos app, Manually yous tin navigate to to a higher house covert from Views -> Rating Bar.

Create And Run Test
Create bellow given bear witness inwards eclipse too run it using testng too appium.

SetStarRating.java
package Android;  import io.appium.java_client.TouchAction; import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  populace bird SetStarRating {  AndroidDriver driver;   @BeforeTest  populace void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "io.appium.android.apis");   capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);   // Scroll till chemical component subdivision which contains "Views" text If It Is non visible on screen.   driver.scrollTo("Views");   // Click on Views.   driver.findElement(By.name("Views")).click();   // Scroll till chemical component subdivision which contains "Rating Bar" text If It Is non visible on screen.   driver.scrollTo("Rating Bar");   // Click on Rating Bar.   driver.findElement(By.name("Rating Bar")).click();  }   //Set 3 StarRatingbar = i star.  @Test  populace void set3StarRatingbar(){     //Locate threeStarRatingbar.   WebElement threeStarRatingbar = driver.findElement(By.id("io.appium.android.apis:id/ratingbar1"));   //Get root signal of threeStarRatingbar.   int startX = threeStarRatingbar.getLocation().getX();   System.out.println(startX);   //Get halt signal of threeStarRatingbar.   int endX = threeStarRatingbar.getSize().getWidth();   System.out.println(endX);   //Get vertical place of threeStarRatingbar.   int yAxis = threeStarRatingbar.getLocation().getY();      //Set threeStarRatingbar tap seat to laid upwardly Rating = i star.   //You tin move endX * 0.3 for i star, endX * 0.6 for ii star, endX * i for 3 star.   int tapAt = (int) (endX * 0.3);       //Set threeStarRatingbar to Rating = 1.0 using TouchAction class.   TouchAction act=new TouchAction(driver);     act.press(tapAt,yAxis).release().perform();  }    //Set 5 StarRatingbar = iv star.  @Test  populace void set5StarRatingbar(){     //Locate fiveStarRatingbar.   WebElement fiveStarRatingbar = driver.findElement(By.id("io.appium.android.apis:id/ratingbar2"));   //Get root signal of fiveStarRatingbar.   int startX = fiveStarRatingbar.getLocation().getX();   System.out.println(startX);   //Get halt signal of fiveStarRatingbar.   int endX = fiveStarRatingbar.getSize().getWidth();   System.out.println(endX);   //Get vertical place of fiveStarRatingbar.   int yAxis = fiveStarRatingbar.getLocation().getY();      //Set fiveStarRatingbar tap seat to laid upwardly Rating = iv star.   //You tin move endX * 0.2 for i star, endX * 0.4 for ii star, endX * 0.6 for 3 star, endX * 0.8 for iv star, endX * i for 5 star.   int tapAt = (int) (endX * 0.8);     //Set fiveStarRatingbar to Rating = iv star using TouchAction class.   TouchAction act=new TouchAction(driver);     act.press(tapAt,yAxis).release().perform();  }   @AfterTest  populace void End() {   driver.quit();  } }

As yous tin run across inwards to a higher house test, I convey created 2 @Test methods. 1st @Test method volition give i star rating on 3 star rating bar too 2d @Test method volition give iv star rating on 5 star rating bar. If yous wants to increase or decrease star rating therefore yous tin laid upwardly value of tapAt every bit per your requirement every bit depict inwards bear witness comment.

This is the agency to handgrip star rating bar inwards android software application automation bear witness using appium.
Appium - Perform Longpress Using Touchaction Inward Android Dialer App

Appium - Perform Longpress Using Touchaction Inward Android Dialer App

24Sometimes you lot take away to press together with hold(long press) an element for few seconds to decease required effect In your android software app. In this instance nosotros tin use longPress(org.openqa.selenium.WebElement el) method of TouchAction flat In appium automation test. Earlier nosotros accept used longPress method to generate activeness chain of DRAG AND DROP, SWIPE ACTION together with MULTI TOUCH ACTION. Here I am presenting uncomplicated representative on exact usage of longPress method of TouchAction class In appium software automation test.

App To Use In This Test
We volition utilization android mobile Dialler app In this representative to sympathize usage of LongPress method. Dialler app volition live on Installed yesteryear default In all android devices together with then no take away to Install It.

Aim To Achieve
On dialler pad, 0 push has 2 functions. 1. It volition dial 0 on normal press. 2. It volition dial + on long press. Try It manually first.

In our appium software automation test, We volition long press 0 push of dialler pad to dial + equally shown In bellow Image. It volition type + In dial set out textbox.


Create And Run Android Appium LongPress Test
Create novel flat file DialPad.java nether your project's parcel In eclipse together with re-create glue bellow given android appium software seek out script In It.

DialPad.java
package Android;  import io.appium.java_client.TouchAction; import io.appium.java_client.android.AndroidDriver;  import java.net.URL; import java.util.concurrent.TimeUnit;  import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  populace flat DialPad {  AndroidDriver driver;   @BeforeTest  populace void setUp() throws Exception {   DesiredCapabilities capabilities = novel DesiredCapabilities();   capabilities.setCapability("deviceName", "ZX1B32FFXF");   capabilities.setCapability("browserName", "Android");   capabilities.setCapability("platformVersion", "4.4.2");   capabilities.setCapability("platformName", "Android");   capabilities.setCapability("appPackage", "com.android.dialer");   capabilities.setCapability("appActivity","com.android.dialer.DialtactsActivity");   driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);   driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);  }   @Test  populace void dial() {   //Click on dial pad push to opened upwards dialer pad.   driver.findElementById("com.android.dialer:id/dialpad_button").click();   //Create object of TouchAction class.   TouchAction Action = novel TouchAction(driver);   //Create activeness chain using TouchAction flat reference to perform long press activeness on push 0 of dialer pad.   Action.longPress(driver.findElement(By.name("0"))).perform();   //Get the effect from dial text box.   String effect = driver.findElementById("com.android.dialer:id/digits").getText();   //Compare actual together with expected effect using testng assertion.   Assert.assertEquals(result, "+", "Actual value is : "+ result+ " did non fit amongst expected value: +");    }   @AfterClass  populace void tearDown() {   driver.quit();  } }

As you lot tin encounter In inward a higher house android appium software automation seek out script, 
  • First It volition launch dialler pad app using given parcel together with activity name.
  • Open dialler pad yesteryear clicking on dial pad button.
  • Action.longPress method Is used to press together with concur 0 push on dial pad.
  • Next disputation volition decease text from dial text box.
  • Used testng assertion Assert.assertEquals to compare actual together with expected result. You tin larn to a greater extent than close testng and It's assertions on THIS PAGE.
Run inward a higher house representative using testng together with uncovering execution In your android device screen. It volition dial + yesteryear long press 0 button.

This Is the means of using longpress method of TouchAction flat to long press on whatever chemical component of your android software app.
What Is Selenium Grid 2? When To Purpose Grid?

What Is Selenium Grid 2? When To Purpose Grid?

Earlier nosotros learnt selenium WebDriver/Selenium 2 tutorials amongst practical examples together with you lot tin honour all webdriver tutorials links on THIS PAGE. Selenium Grid 2 may last novel for close of you lot but you lot must needs to acquire It because If you lot wants to run your selenium software tests In multiple browser versions together with OS parallel hence you lot ask Selenium Grid 2. Let's endeavor to sympathise what Is selenium Grid together with when to purpose It.

What Is Selenium Grid 2?
Selenium Grid Is simply about other projection of selenium. Selenium grid render us facility for distributed software essay execution. Using selenium Grid, We tin execute our selenium WebDriver software tests In unlike browsers, unlike browsers versions together with unlike browser versions running on unlike operating systems In parallel at the same time.

Basically selenium grid has 1 hub together with multiple nodes. Each node amongst same or unlike environments (As per your requirement) to executed tests In parallel.

Bellow given Images shows representative construction of  selenium Grid. You tin run across at that spot Is unmarried Hub machine connected to multiple nodes(with unlike configuration) machine. You ask node machine equally per your requirement.

When To Use Grid 2?
Main questions Is what are the benefits of selenium grid together with why nosotros needs to purpose It. Mainly at that spot are ii reasons behind usage of selenium grid In software testing Industry.
  1. To perform compatibility testing - You tin run same essay In multiple environments hence that It volition last really slowly for you lot to perform compatibility testing using selenium grid.
  2. To trim down essay execution time - As you lot know, nosotros tin run same essay In multiple machines at same fourth dimension hence It volition trim down your essay execution time.
Using selenium grid, you lot tin speedup software essay execution process. Supposing your fifty software automation essay cases takes five hours to consummate execution In 1 machine hence selenium grid amongst five nodes configuration volition conduct keep solely 1 hr to execute fifty essay cases. This Is the primary create goodness of using selenium Grid.

NEXT POST volition depict you lot how to configure selenium grid from scratch to run selenium WebDriver software essay cases.

Selenium Grid Ii Configuration - Setup Hub To Live Selenium Webdriver Tests

Selenium Grid Ii Configuration - Setup Hub To Live Selenium Webdriver Tests

We learnt what is Selenium Grid 2 together with when to usage it inward PREVIOUS POST. Selenium Grid is approximately other projection of selenium thus y'all hollo for to configure selenium grid 2 from scratch to execute selenium webdriver software exam cases parallel in grid. Let's elbow grease to configure selenium grid In unmarried machine together with and thus nosotros volition run selenium webdriver tests In It.

As described In my previous post, We hollo for to setup 1 hub together with multiple nodes (number of nodes depends on your requirement) to execute selenium webdriver software exam cases parallel on selenium grid nodes.

What Is Hub?
In selenium grid, Hub is a fundamental indicate which have software exam requests together with transportation those software exam requests to nodes for execution. In our representative of selenium webdriver, When nosotros kickoff executing software exam on selenium grid, Grid hub volition have together with create create exam requests together with and thus transportation them to registered node machine. We tin configure node on same machine or dissimilar machines too. We volition acquire to a greater extent than nearly nodes inward upcoming post.

Setting Up Selenium Grid ii Hub
To execute selenium webdriver exam cases parallel In selenium grid, We hollo for to laid upwards selenium grid hub In your machine which volition supply available capabilities together with configuration to webdriver tests.

Step 1 : Download Selenium Standalone Server jar
You tin download selenium standalone server from THIS PAGE.

Current latest version of selenium standalone server is 2.52.0 thus y'all volition acquire "selenium-server-standalone-2.52.0.jar" file. Put it inward D: drive.

Note : If your selenium standalone server version is dissimilar than usage that version release inward all bellow steps. Otherwise it volition non run for you.

Step ii : Start Selenium Grid Hub
To kickoff hub,
  1. Open ascendance prompt
  2. Navigate to D: create past times typing ascendance D: inward ascendance prompt.
  3. Type bellow given ascendance syntax inward ascendance prompt and press ENTER button.
java -jar selenium-server-standalone-2.52.0.jar -port 4444 -role hub

Command elements
  • selenium-server-standalone-2.52.0.jar -> Selenium standalone server jounce file version. Modify It every bit per your jounce file version inward higher upwards ascendance if it is non 2.52.0.
  • 4444 -> Port used past times hub to brain nodes.
Note : Please restart hub and  if seem upwards whatsoever effect on whatsoever phase during test. To restart grid ii hub
  • Press CTRL+c keys of keyboard to shutdown node.
  • Run higher upwards ascendance in 1 lawsuit once to a greater extent than to register node amongst hub.
Verify whether grid hub is running fine
It volition exhibit y'all message -> "Selenium Grid hub is upwards together with running." every bit shown inward bellow image.

Now y'all tin access selenium grid console using URL : http://localhost:4444/grid/console. Open this URL inward whatsoever browser. It volition exhibit y'all page similar bellow.

That way selenium grid hub is configured properly together with develop to use. We volition acquire how to configure nodes for seleniun grid ii hub inward NEXT POST.