Sample Test Script for Real iOS Device



Here is the Sample Test Script for Real iOS Device.

using NUnit.Framework;

using OpenQA.Selenium;

using OpenQA.Selenium.Remote;

using OpenQA.Selenium.Support.UI;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace SeleniumHelloWorld

{

class IOSDevice

{

public IWebDriver driver;

[TestFixtureSetUp]

public void Class1()
{

//Setting Capabilities
DriverOptions cap = new AppiumOptions();

cap.AddAdditionalCapability(MobileCapabilityType.DeviceName, "iPhone 6s+");
cap.AddAdditionalCapability(MobileCapabilityType.App, ”/Users/ADMIN/Desktop/CaliculatorApp.app”);
cap.AddAdditionalCapability(MobileCapabilityType.PlatformName, "iOS");
cap.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "11.1.2");
cap.AddAdditionalCapability(MobileCapabilityType.BundleId, "com.ca.projectpocket");
cap.AddAdditionalCapability(MobileCapabilityType.Udid, "ce5ed873b232aa748a2e51a09d305790fb96abc9"); //Device id

//Connecting to Appium Server

driver = new RemoteWebDriver(new Uri(“http://localhost:4723/wd/hub”), cap); //Appium Server in running from your local machine

}

Test Case:

[Test()]

public void VerifyMenuDevice()

{

//Test to enter loginname & Password on login page

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(2));

wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(“//UIAButton[1]”)));

driver.FindElement(By.XPath(“//UIATextField[1]”)).SendKeys(“username”);

driver.FindElement(By.XPath(“//UIASecureTextField[1]”)).SendKeys(“password”);

driver.FindElement(By.XPath(“//UIAButton[1]”)).Click();

}

Clean Up:

[TestFixtureTearDown]

public void End()

{

driver.Quit();

}

}

}
Tags: ,
Leave a comment

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

Subscribe now

Receive weekly newsletter with educational materials, new courses, most popular posts, popular books and much more!

https://bridgejunks.com/ https://crownmakesense.com/ https://brithaniabookjudges.com/ https://hughesroyality.com/ https://rhythmholic.com/ https://bandar89.simnasfikpunhas.com/ https://www.100calshop.co.il/products/thailand/ https://myasociados.com/ https://solyser.com/ http://konfidence.cz/ https://muscadinepdx.com/ https://bandar89.parajesandinos.com.ve/ https://goremekoop.com/ https://oncoswisscenter.com/ https://www.turunclifehotel.com/bandar89/ https://www.houseofproducts.biz/ https://taimoormphotography.com/
BIJI18 BIJI18 BIJI18