Skip to content

Iptv Assist

Learn More from us

Menu
  • HOW TO
  • Firestick
  • Chromecast
  • PC Apps
  • Lg Smart TV
  • IPTV Services
  • Automation Testing
  • Smart TV
  • Software Testing Tools
  • Contact Us
Menu

Using Selendroid to Automate the User Interactions Over a Mobile App (Part 2)

Posted on March 26, 2023

Best Iptv Service Provider 2023 With 40k+ Channels And 100k+ VOD . 24/7 Suppport . Paypal Supported

How to use Selendroid framework to automate the user interactions over a mobile application (Part-2). Also, read our ‘Selendroid Introduction Part 1‘ tutorial.

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

Selendroid is an amazing testing tool, which has several important features as well.

Recommended IPTV Service Providers

  1. IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
  2. IPTVRESALE – Rating 5/5 ( 200+ Reviews )
  3. IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
  4. IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
  5. IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
  6. IPTVTOPS – Rating 5/5 ( 43 Reviews )

 

It is a very powerful automation test framework tool which can interact with multiple devices simultaneously. An application can be tested without any modification or change using Selendroid.

In this tutorial, let us see, how to use the Selendroid framework to automate the user interactions over a mobile application (.apk files).

How to Use Selendroid

The app under test is a recipe app, which a user can access to view, rate and perform other things. We can run this app both online as well as offline.

What You Will Learn:

  • Expectation from the script
  • Application Setup
    • Selendroid Script
    • Here are few snapshots of the application
  • Viewing Console Result
  • Conclusion

Expectation from the script

  • Start the server, install the apk file (if not installed previously)
  • Launch the application
  • Access the menu list and navigate to a particular category
  • Perform the advanced search to filter out the recipe within the category
  • Add review comment to the recipe
  • Verify the added review comment
  • View list of all recipe created by the author of the current recipe

Application Setup

We need to create a user over BigOven app as which would be required while adding ratings. The user credentials will be useful while we Login to the step of automating the script.

To start with:

1) Make sure that the Selendroid server is started using the following command.
E.g. java –jar selendroid-standalone-0.15.0-with-dependencies.jar –aut 250000RecipesBigOven.apk
Note: 250000RecipesBigOven.apk is the application under test.

2) Make sure whether the physical device is connected to the PC and any test environment with USB debugging mode is enabled.

3) Make sure that the required Selendroid, selenium jar files are already imported and attached to the libraries.

FileLocation

The first step would be creating new  Package

Package

Mentioning the package name

CreateTestNG

Next step would be creating a TestNG test case under the above package.

Creating new TestNG Class

1) Open the eclipse project
2) Right-click on the package name. Here it is SelendroidFirst
3) Click on TestNG >> create TestNG class

Specifying the Class Name say ‘BigOven’

CreateTestNG

Selendroid Script

Now paste the following codes over the newly created class ‘BigOven’:

package SelendroidFirst;

import io.selendroid.client.SelendroidDriver;
import io.selendroid.client.TouchAction;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;

import io.selendroid.common.SelendroidCapabilities;
import io.selendroid.common.device.DeviceTargetPlatform;
import io.selendroid.standalone.SelendroidConfiguration;
import io.selendroid.standalone.SelendroidLauncher;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.List;

public class BigOven{
	
	public SelendroidLauncher selendroidServer = null;
	public static WebDriver driver = null;
		
	@Test(groups= {"Example"})
	public  void BigOven() throws Exception
	{

//**Configurations*//
SelendroidConfiguration config = new SelendroidConfiguration();config.addSupportedApp
("D:\AppiumAutomation\SelendroidFirst\250000RecipesBigOven.apk");
SelendroidLauncher selendroidServer = new SelendroidLauncher(config);
selendroidServer.launchSelendroid();
SelendroidCapabilities caps = new SelendroidCapabilities();
caps.setAut("com.bigoven.android:3.3.1");
WebDriver driver = new SelendroidDriver(caps) ;
caps.setEmulator(false);	

//**Access Recipe list of particular category**//
driver.findElement(By.id("left_image")).click();
List<WebElement> kg1=driver.findElement(By.id("kitchen_grid")).findElements(By.id("grid_item_layout"));
for(WebElement kg2:kg1)
{
if(kg2.findElement(By.id("bottom_text")).getText().equals("Browse By Category"))
{
kg2.click();
break;
}
}
Thread.sleep(2000);
List<WebElement> kg4 = driver.findElement(By.id("select_dialog_listview")).findElements(By.id("text1"));
for(WebElement kg3:kg4)
{
if(kg3.getText().equals("Breakfast"))
{
kg3.click();
break;
}
}

//**Viewing Recipe Details page**//
driver.findElement(By.id("menu_refine_search")).click();
List<WebElement> bs = driver.findElement(By.id("layout_search_by_ingredients")).findElement
(By.id("buttons_layout")).findElements(By.id("search_ingredients_button"));
Thread.sleep(2000);
System.out.println(bs.get(0).getText());
bs.get(0).click();
Thread.sleep(2000);

//**Adding Rating Review to a particular recipe**//
List<WebElement> bl = driver.findElement(By.className("android.widget.ListView")).findElements
(By.id("recipe_title"));
for(WebElement bi : bl)
{
System.out.println(bi.getText());
}
bl.get(0).click();
Thread.sleep(2000);
driver.findElement(By.id("recipe_rate_text")).click();
Thread.sleep(2000);
driver.findElement(By.id("username_edit")).sendKeys("[email protected]");
driver.findElement(By.id("password_edit")).sendKeys("xxxxxxx");
driver.findElement(By.id("login_button")).click();
Thread.sleep(2000);
driver.findElement(By.id("review_comment")).sendKeys("Review Comment added by testuser");
driver.findElement(By.id("add_item")).click();
Thread.sleep(2000);
driver.findElement(By.id("vp_reviews_layout")).findElement(By.id("vp_reviews_img")).click();
Thread.sleep(2000);
List<WebElement> rl = driver.findElements(By.id("review_info"));
List<WebElement> rc = driver.findElements(By.id("reviewer_comment"));
WebElement rle = rl.get(0);
WebElement rce = rc.get(0);
if(rle.getText().contains("Testuser12345")&& rce.getText().equals("Review Comment added by testuser"))
{
System.out.println("Review added successfully");
}

//**Viewing all the recipes added by the user**//
driver.findElement(By.id("vp_recipe_layout")).findElement(By.id("vp_recipe_img")).click();
Thread.sleep(2000);
String AuthorName = driver.findElement(By.id("recipe_author_name")).getText();
System.out.println("List of recipe created by Author: " + AuthorName);
driver.findElement(By.id("recipe_author_image")).click();
Thread.sleep(2000);
		
}
@AfterTest
public void afterClass() {
if(driver!=null)
{
driver.quit();
}
}
}

Once we have written the test script, the next step to Run the Script.

Select the test case >> right-click >> Run As >> TestNG Test.

Run

Here are few snapshots of the application

Landing page:

HomePage

Category list page:

Search

Search refine page:

Menu

Viewing the Detail recipe:

Details

Login over BigOven:

Login

Adding Review Comments:

Rating

Viewing the added comment:

Review

Now once the test script is executed successfully, the next step would be viewing the execution result. In TestNG, we can do the same from the console “Results of running class BigOven”.

Viewing Console Result

Console

Selendroid Test Result

We can see the test results from the following default location, In our case it is SelendroidFirst >> test-output >> index.html

This is how we can execute the test cases.

We can also create testing XML file and then execute it and also enhance the test result by using TestNG reporting utility.

Conclusion

Selendroid is an open-source framework which allows us to create automation test cases for mobile applications.

The best thing is, it supports Hotplugging. It supports automation of several user interactions over mobile devices.

But the development work and online support are almost stopped, so we might not get all the features instantly. Hence we may face some problem while performing few actions like swap. At times we have to create our own function as well.

This is the end of the Selendroid tutorial series. Please share your comments, questions, and thoughts below.

Related

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

Leave a Reply Cancel reply

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

Recent Posts

  • IPTV List: Best iptv lista 2023
  • IPTV Premium: Best Premium IPTV Service Provider List And Benefits
  • Nikon IPTV Review: Over 10,000 Live Channels for $12/Month
  • Iptvwings. Com Review: +18000 Live IPTV Channels ,+70000 Movies, +40000 TV show For $15/1 month
  • IPTVUNO Review: More Than 16000 Live TV channels, 55,000 Movies & VOD For $15/Month

Recent Comments

  1. IPTV List: Play lista iptv 2022 - Iptv Assist on Best IPTV Player in 2023 for Watching Live TV
  2. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on FileLinked – How to Install on Firestick/Fire TV and Android Devices
  3. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on 50+ Best IPTV Service Providers for Streaming Live TV 2023
  4. XoomsTV IPTV – Over 11,000 Channels & VOD for Under $13/Month on Best VPN for IPTV in 2023 and How to Install on Firestick/Android
  5. Voodoo Streams IPTV Review – Over 12,000 Channels for $11/Month - Iptv Assist on Dynasty TV IPTV Review – Over 6,000 Channels for $10/Month

Archives

  • March 2023

Categories

  • Activate
  • Agile Testing
  • Alternatives
  • Android
  • APK
  • Apple TV
  • Automation Testing
  • Basics of Software Testing
  • Best Apps
  • Breakfast Hours
  • Bug Defect tracking
  • Career in Software Testing
  • Chromebook
  • Chromecast
  • Cross Platform
  • Database Testing
  • Delete Account
  • Discord
  • Error Code
  • Firestick
  • Gaming
  • General
  • Google TV
  • Hisense Smart TV
  • HOW TO
  • Interview Questions
  • iPhone
  • IPTV
  • IPTV Apps
  • Iptv Service SP
  • IPTV Services
  • JVC Smart TV
  • Kodi
  • Lg Smart TV
  • Manual Testing
  • MI TV
  • Mobile Testing
  • Mod APK
  • newestiptv.com
  • News
  • Nintendo Switch
  • Panasonic Smart TV
  • PC Apps
  • Performance Testing
  • Philips Smart TV
  • PS4
  • PS5
  • Python
  • QA Certifications
  • QA Leadership
  • QA Team Skills
  • Quality Assurance
  • Reddit
  • Reviews
  • Roku
  • Samsung Smart TV
  • Screenshot
  • Selenium Tutorials
  • Sharp Smart TV
  • Skyworth Smart TV
  • Smart TV
  • Soft Skills For Testers
  • Software Testing Templates
  • Software Testing Tools
  • Software Testing Training
  • Sony Smart TV
  • Sports
  • Streaming Apps
  • Streaming Devices
  • Tech News
  • Test Management Tools
  • Test Strategy
  • Testing Best Practices
  • Testing Concepts
  • Testing Methodologies
  • Testing News
  • Testing Skill Improvement
  • Testing Tips and Resources
  • Toshiba Smart TV
  • Tutorials
  • Twitch
  • Types of Testing
  • Uncategorized
  • Vizio Smart TV
  • VPN
  • Web Testing
  • What is
  • Xbox
©2023 Iptv Assist | Design: Newspaperly WordPress Theme