Wie zu Beginn appium Tests auf iOS-simulator?
Habe ich Folgendes setup und versucht zu starten, der test auf iOS Simulator
. Ich bin ein Anfänger und weiß nicht, wie um den test zu starten. Ich habe bereits importiert und installiert appium
von tutorials.
Die Fragen:
- Ist dieses setup das richtige?
- Wie laufen die tests?
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();
}
}
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ja, Ihre Einrichtung korrekt ist. Sieht aus wie Sie mit testng-framework, so führen Sie es einfach als "testng" und Sie sollten gut zu gehen.