如何在iOS模拟器上启动Appium测试? [英] How to start appium test on iOS simulator?
本文介绍了如何在iOS模拟器上启动Appium测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我具有以下设置,并尝试在iOS Simulator
上开始测试.我是初学者,不知道如何开始测试.我已经从教程中导入并安装了appium
.
I have the following setup and trying to start the test on iOS Simulator
. I am a beginner and don't know how to start the test. I have already imported and installed appium
from tutorials.
问题是:
- 此设置正确吗?
- 如何运行测试?
import java.io.File;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class AppiumDriver {
private static final String JavascriptExecutor = null;
public WebDriver driver = null;
@BeforeMethod
public void setUp() throws Exception {
// set up appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
capabilities.setCapability(CapabilityType.VERSION, "8.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("device", "iPhone");
capabilities.setCapability("app", "path here, i have started it with appium inspector and it works");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
System.out.println("App launched");
}
@Test
public void test01() throws InterruptedException {
driver.findElement(By.name("Guest")).click();
Thread.sleep(5000);
}
@AfterMethod
public void tearDown() throws Exception {
driver.quit();
}
}
推荐答案
是的,您的设置正确.看起来您正在使用testng框架,因此只需将其作为"testng"运行,就可以了.
Yes, your setup is correct. Looks like you are using testng framework so just run it as "testng" and you should be good to go.
这篇关于如何在iOS模拟器上启动Appium测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文