Не могу настроить Selenide и Appium для IOS
Образец взятый с репозитория Selenide работать не захотел

При инициализации AppiumDriver на эмуляторе запускается приложение, так что не получается только передать команды Selenide в Appium.
import org.junit.Before;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;
public class CustomMobileDriver {
AppiumDriver driver;
@Before
public void getIosDriver() throws MalformedURLException {
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("platformName", "iOS");
desiredCapabilities.setCapability("deviceName", "iPhone 11");
desiredCapabilities.setCapability("platformVersion", "14.1");
desiredCapabilities.setCapability("automationName", "XCUITest");
desiredCapabilities.setCapability("app", "/Users/alekseigerasimov/1/UIKitCatalog.app");
URL remoteUrl = new URL("http://localhost:4723/wd/hub");
driver = new AppiumDriver(remoteUrl, desiredCapabilities);
}
}
Тест падает с ошибкой:
java.lang.IllegalArgumentException: Failed to create WebDriver of type io.appium.java_client.ios.IOSDriver
С такой конфигурацией браузера "Configuration.browser = AppiumDriver.class.getName();" тоже ошибка:
java.lang.IllegalArgumentException: Failed to create WebDriver of type io.appium.java_client.AppiumDriver
import com.codeborne.selenide.Configuration;
import io.appium.java_client.ios.IOSDriver;
import org.junit.Before;
import org.junit.Test;
import static com.codeborne.selenide.Selenide.closeWebDriver;
import static com.codeborne.selenide.Selenide.open;
public class IosTest extends CustomMobileDriver {
public Page page = new Page();
@Before
public void before() {
closeWebDriver();
Configuration.browserSize = null;
Configuration.browser = IOSDriver.class.getName();
open();
}
@Test
public void test () {
page.buttonPageControl.click();
}
}
Использую 2 зависимости:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>IosTest</scope>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide-appium</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
Вопросы: 1.Как передать команды Selenide в Appium?
2.Что нужно передать в эту конфигурацию? Configuration.browser = IOSDriver.class.getName(); Сейчас передается: "io.appium.java_client.ios.IOSDriver"
Ответы (1 шт):
Автор решения: GerasimovQA
→ Ссылка
This is working case:
import com.codeborne.selenide.WebDriverProvider;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.options.XCUITestOptions;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.net.MalformedURLException;
import java.net.URL;
@ParametersAreNonnullByDefault
public class IOSDriverProvider implements WebDriverProvider {
@Override
@CheckReturnValue
@Nonnull
public WebDriver createDriver(Capabilities capabilities) {
XCUITestOptions options = new XCUITestOptions();
options.merge(capabilities);
options.setAutomationName("XCUITest");
options.setPlatformName("iOS");
options.setDeviceName("iPhone 11");
options.setPlatformVersion("14.1");
options.setApp("/Users/alekseigerasimov/1/UIKitCatalog.app");
try {
return new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), options);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Android_Ios_Selenide</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>IosTest</scope>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide-appium</artifactId>
<version>2.0.4</version>
<exclusions>
<exclusion>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>8.1.1</version>
</dependency>
</dependencies>
</project>