Appium-ios Start Deome

Source: Internet
Author: User
Tags appium testng

Package com.appium.cases;



Import Org.openqa.selenium.By;

Import org.openqa.selenium.remote.DesiredCapabilities;

Import Org.testng.annotations.AfterClass;

Import Org.testng.annotations.BeforeClass;

Import Org.testng.annotations.Test;


Import Io.appium.java_client.ios.IOSDriver;

Import io.appium.java_client.ios.IOSElement;

Import Io.appium.java_client.remote.IOSMobileCapabilityType;

Import Io.appium.java_client.remote.MobileCapabilityType;


Import Java.io.File;

Import Java.net.URL;


public class Iosdeijtong {

Iosdriver<ioselement> driver;

Command line Startup

@BeforeClass

public void SetUp () throws Exception {

File Appdir = new file (System.getproperty ("User.dir"));

Final file App = new file (appdir, "/app/toon.ipa");

Desiredcapabilities capabilities = new Desiredcapabilities ();

Capabilities.setcapability ("PlatformName", "IOS"); Mobile OS

Capabilities.setcapability ("Platformversion", "11.0.3"); The phone OS version to start

Capabilities.setcapability ("DeviceName", "IPHONEXQ"); Phone type or simulator type, such as Mi_2a/android Emulator/iphone Simulator

Capabilities.setcapability ("Udid", "0259411d3508a459149c8aec521ff5845a2e835b"); Physical Machine ID//using MAC platform a779c7953c50967fca89500e932981029e306659

Capabilities.setcapability ("Usenewwda", false); False

Capabilities.setcapability (Mobilecapabilitytype.automation_name, "xcuitest");

Capabilities.setcapability (mobilecapabilitytype.new_command_timeout, 3600);

Capabilities.setcapability (Iosmobilecapabilitytype.auto_accept_alerts, true); All iOS reminders appear selected to accept

Capabilities.setcapability ("Bundleid", "Com.systoon.beijingtong");

Capabilities.setcapability ("App", App.getabsolutepath ()); Get the App absolute path (a path under engineering if the installation is enabled, without booting if not installed)

Driver = new Iosdriver (New URL ("Http://127.0.0.1:4723/wd/hub"), capabilities);

}


@Test

public void Allinlogin () throws Interruptedexception {//Login

/** Allow */

Thread.Sleep (5000);

//system.out.println (Driver.getpagesource ()); Get element

//driver.findelement (By.name ("Allow")). Click ();

//login user name Xcuielementtypetextfield

driver.findelementbyname ("Please enter your mobile phone number"). Clear ();

driver.findelementbyname ("Please enter your mobile phone number"). SendKeys ("14725000001");

//password

driver.findelementbyname ("Please enter your password"). SendKeys ("1111");

//Login

driver.findelementbyname ("Login"). Click ();

Thread.Sleep (5000);

System.out.println ("This is the post-login page");

System.out.println (Driver.getpagesource ()); Get element

Final webelement Text = river.findelement (By.xpath ("//uiatextfield[1]");

}

@AfterClass

public void TearDown () throws Exception {

Driver.quit ();

}


}


Appium-ios Start Deome

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.