Selendroid Eclipse Setup



Comments



Description

Selendroid is a test automation framework used in automation of Android native and hybrid apps and the mobileweb. Tests in Selendroid are written in Selenium WebDriver client API. This post covers step-by-step tutorial to perform Selendroid Setup in Eclipse IDE using WebDriver. W e will use TestNG framework in our setup and write a test on Selenium WebDriver using Java. The test will be carried out on sample Selendroid app installed in an emulator. But before we proceed further, let’s ensure we have below prerequisites met for Selendroid setup. Prerequisites: o Java SDK installed in the system and JAVA_HOME configured to point to JDK. o Android SDK installed in the system and ANDROID_HOME set. o Selendroid client and server JAR files and TestNG JAR file. o Eclipse (with TestNG configured) We can now start with Selendroid setup in Eclipse. Perform below steps for it. o Start an emulator to run your test on or connect your device to the system. o Download Selendroid server JAR file from above link. Also download Selendroid sample app from here. o Put both downloaded files in same directory. Open Command Prompt and go to the directory where both these files are stored. o Run below command in Command Prompt. It starts Selendroid server for the app under test. SelendroidDriver.annotations.findElement(By. 4 5 import org. package com.findElement(By. 28 WebElement element2 = 29 driver.annotations.WebElement.testng.0.jar -app selendroid-test-app-0.selendroid. 11 12 public class SelendroidTest { 13 14 public WebDriver driver. 38 } } .selenium.test. 8 import org. 15 16 @BeforeSuite 17 public void setUp() throws Exception { 18 SelendroidCapabilities capa = new SelendroidCapabilities( 19 "io. 31 WebElement element3 = driver.xpath("//ImageButton[@id='buttonStartWebview']")).click(). server and TestNG JAR files.selenium. similar to below screenshot.0").selendroid. app details etc. 32 element3. 20 driver = new SelendroidDriver(null. To check if Selendroid server is running correctly.Test. 9 import org. It should show connected devices. 33 } 34 35 @AfterSuite 36 public void tearDown() { 37 driver.testng. go to http://localhost:4444/wd/hub/status URL in your browser. 27 element1.xpath("//ImageButton[@id='startUserRegistration']")).By.click().13.0-with-dependencies. 3 import io. o Create a Java project in your Eclipse and reference Selendroid client.openqa.findElement(By. 10 import org.1 java -jar selendroid-standalone-0.testapp:0. 21 } 22 23 @Test 24 public void selenTest() throws Exception { 25 WebElement element1 = 26 driver. 1 2 import io.WebDriver.testng.BeforeSuite. o Create a class file in your project and write below code. 6 import org.13.apk o Selendroid server gets started on running the above command.12.selendroid.click(). 30 element2.selendroid. The app name displayed in Capabilities code is taken from ‘appId’ parameter shown in above image.annotations.quit().openqa.AfterSuite. 7 import org.selenium.SelendroidCapabilities.xpath("//Button[@id='goBack']")).openqa. capa). Important point to note here.INTERNET"/> That means your Android application’s Manifest file needs to have the above permission.o Run your test using TestNG. 1 <uses-permission android:name="android. .**permission. We hope you have enjoyed the above article about Selendroid setup in Eclipse IDE. Selendroid requires following permission for the app. We would love to hear your inputs in comment.
Copyright © 2024 DOKUMEN.SITE Inc.