Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Appium-ios starts deome

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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 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"); //OS version of phone to boot

capabilities.setCapability("deviceName", "iPhonexq"); //phone type or simulator type, e.g. MI_2A/Android Emulator/iPhone Simulator

capabilities.setCapability("udid","0259411d3508a459149c8aec521ff5845a2e835b"); //physical machine ID //Mac platform used 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 alerts appear with option ACCEPT

capabilities.setCapability("bundleId", "com.systoon.beijingtong");

capabilities.setCapability("app", app.getAbsolutePath()); //Get the absolute path of the app (a path under the project is enabled if installed, not started 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 Username XCUIElementTypeTextField

driver.findElementByName("Please enter mobile number").clear();

driver.findElementByName("Please enter the mobile phone number").sendKeys("1472500001");

//Password

driver.findElementByName("Please enter your password").sendKeys("1111");

//Login

driver.findElementByName("Login").click();

Thread.sleep(5000);

System.out.println("This is the 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();

}

}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report