For Video Tutorial : Move on Youtube Channel
Note : Select the playlist as per your need & move with number sequence
Data Driven Framework in Appium:
For Video : CLICK HERE For Part1
Hello Friends,
In this tutorial we will discuss how to create Data Driven Framework in appium for Android.
It is very similar as we created in Selenium for any web application.
Click Here
for selenium data driven framework.Suppose we have below scenarios/Task to automate on Android to add multiple contacts in android :-
Our Scenarios will be as below :
1).Open Android dialer
2).Click on contacts
3).Click on create contacts
4).Enter Name
5).Enter Mobile Number
6).Click save button
7).Click on home Button
We will write the code in eclipse to achieve the objective.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.apache.poi.ss.usermodel.DataFormatter;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidKeyCode;
import io.appium.java_client.remote.MobileCapabilityType;
public class Newtest2
{
static AndroidDriver
XSSFWorkbook wb;
static XSSFSheet sheet;
FileInputStream fis;
@BeforeTest
public void g() throws IOException
{
File src = new File("D:\\study material\\Selenium Final complete\\Appium software\\contactsdata\\contact_data.xlsx");
fis = new FileInputStream(src);
wb = new XSSFWorkbook(fis);
sheet = wb.getSheetAt(0);
}
@Test
public void main() throws MalformedURLException, InterruptedException
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "LYF");
capabilities.setCapability(MobileCapabilityType.VERSION, "6.0.1");
capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Andriod");
capabilities.setCapability("appPackage", "com.android.dialer");
capabilities.setCapability("appActivity", "com.android.dialer.DialtactsActivity");
File file = new File("C:\\Users\\cchauhan\\Downloads\\New Appium\\src\\apk file\\.apk");
capabilities.setCapability("apk", file.getAbsolutePath());
driver = new AndroidDriver
for(int i =121 ; i<131; i++)
{
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.id("Contacts")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.id("Create new contact")).click();
List
String data = sheet.getRow(i).getCell(0).getStringCellValue();
list.get(0).sendKeys(data);
//WebElement Name = driver.findElement(By.name("Name"));
//Name.sendKeys("csc");
driver.pressKeyCode(AndroidKeyCode.ENTER);
Thread.sleep(3000);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
DataFormatter formatter = new DataFormatter();
String val = formatter.formatCellValue(sheet.getRow(i).getCell(1));
list.get(1).sendKeys(val);
//WebElement number = driver.findElement(By.name("Phone"));
//number.sendKeys("9718632008");
driver.findElement(By.id("Save")).click();
Thread.sleep(5000);
driver.pressKeyCode(AndroidKeyCode.HOME);
Thread.sleep(3000);
driver.manage().timeouts().implicitlyWait(7, TimeUnit.SECONDS);
List
list2.get(5).click();
}
}
}
Tags :-
Data driven framework in appium, | How to create data driven framework in appium |
Code for data driven framework in appium, | Example of data driven framework in appium |
Thanks for sharing superb one. I'm always keeping this idea in mind.
ReplyDeleteQTP Training in Chennai
best qtp training in chennai
QTP classes
QTP Training
LoadRunner Training in Chennai
DOT NET Training in Chennai
.net coaching centre in chennai
Html5 Training in Chennai
I feel satisfied to read your blog, you have been delivering a useful & unique information to our vision.keep blogging.
ReplyDeleteRegards,
PHP Training in Chennai
PHP Course in Chennai
Tally Course in Chennai
Web Designing Course in Chennai
ReactJS Training in Chennai
ui ux design course in chennai
microsoft dynamics crm training in chennai
ccna Training in Chennai
I gathered lots of information from your blog and it helped me a lot. Keep posting more.
ReplyDeleteR Training in Chennai
R Programming Training in Chennai
Data Science Training in Chennai
Data Science Training Institute in Chennai
Data Science classes in Chennai
Machine Learning Training in Chennai
Machine Learning course in Chennai
Data Science course in Anna Nagar
Good work and you are putting the effort is very great. This post is having clear content about this topic and I hope more valuable post from your innovative blog. Keep it up...
ReplyDeleteOracle DBA Training in Chennai
oracle apps dba training in chennai
Spark Training in Chennai
Oracle Training in Chennai
Linux Training in Chennai
Social Media Marketing Courses in Chennai
Primavera Training in Chennai
Unix Training in Chennai
Power BI Training in Chennai
Tableau Training in Chennai
The development of artificial intelligence (AI) has propelled more programming architects, information scientists, and different experts to investigate the plausibility of a vocation in machine learning. Notwithstanding, a few newcomers will in general spotlight a lot on hypothesis and insufficient on commonsense application. Machine Learning Final Year Projects In case you will succeed, you have to begin building machine learning projects in the near future.
ReplyDeleteProjects assist you with improving your applied ML skills rapidly while allowing you to investigate an intriguing point. Furthermore, you can include projects into your portfolio, making it simpler to get a vocation, discover cool profession openings, and Final Year Project Centers in Chennai even arrange a more significant compensation.
Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account.