Здравствуйте.
Написал свой первый тест для мобильного приложения на Selenium, но хочу перейти на Selenide.
Вот пример теста на Selenium
public class Login {
WebDriver driver;
@Test
public void testSampleTest() throws MalformedURLException, InterruptedException {
DesiredCapabilities capabs = new DesiredCapabilities();
capabs.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
capabs.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabs.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 11 Pro Max (14.3)");
capabs.setCapability(MobileCapabilityType.UDID, "D316BD0B-927E-4404-9F27-096B2C34C857");
capabs.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir") + "/apps/audit.app");
URL url = new URL("http://localhost:4723/wd/hub");
driver = new AppiumDriver<MobileElement>(url, capabs);
WebElement email=driver.findElement(By.name("E-mail"));
email.sendKeys("test@test");
WebElement heslo=driver.findElement(By.name("Pass"));
heslo.sendKeys("4gf654hs");
WebElement logIn=driver.findElement(By.name("LogIn"));
logIn.click();
Thread.sleep(20000);
driver.quit();
}
}
Вот как я переделал на Selenide
public class LoginApp {
WebDriver driver;
@Test
public void testSampleTest() throws MalformedURLException, InterruptedException {
DesiredCapabilities capabs = new DesiredCapabilities();
capabs.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
capabs.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabs.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 11 Pro Max (14.3)");
capabs.setCapability(MobileCapabilityType.UDID, "D316BD0B-927E-4404-9F27-096B2C34C857");
capabs.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir") + "/apps/audit.app");
URL url = new URL("http://localhost:4723/wd/hub");
driver = new AppiumDriver<MobileElement>(url, capabs);
$(By.name("E-mail")).setValue("test@test");
$(By.name("Heslo")).setValue("4gf654hs");
$(By.name("Login")).click();
}
}
Возможно ли изменить что-то еще под Selenide ?
например
capabs.setCapability
Чтобы было покороче.
Спасибо !