У меня есть класс settings в нем сетап `public class Settings {
private DesiredCapabilities capabilities;
private static MobileDriver driver;
public static MobileDriver getDriver() {
return driver;
}
@SneakyThrows
@BeforeTest
void setUp() {
capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.1");
capabilities.setCapability(MobileCapabilityType.UDID, "emulator-5554");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
capabilities.setCapability(MobileCapabilityType.APP, "/home/masha/Downloads/Android-NativeDemoApp-0.2.1.apk");
driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
}
@AfterTest
void tearDown (){
driver.quit();
}
}
` далее у меня базовый класс в котором пытаюсь инизиализировать драйвер
public abstract class BasePaige {
protected MobileDriver driver;
public BasePaige() {
this.driver = getDriver();
PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(5)), this);
}
}
наследуюсь от него
public class TabBarPaige extends BasePaige {
@AndroidFindBy(xpath = "//android.view.View[@content-desc=\\\"Login\\\"]/android.view.View/android.widget.TextView\"")
private MobileElement login;
@AndroidFindBy (id = "button-LOGIN")
private MobileElement buttonLogin;
@AndroidFindBy (xpath = "//android.widget.ScrollView[@content-desc=\"Login-screen\"]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[4]/android.widget.TextView[1]")
private MobileElement text;
public TabBarPaige() {
super();
}
public TabBarPaige clickLogin() {
login.click();
return this;
}
public TabBarPaige clickButtonLogin (){
buttonLogin.click();
return this;
}
public boolean compareText (){
return text.getText().equals("Please enter a valid email address");
}
}
далее пытаюсь все это дело запустить
Assert.assertTrue(new TabBarPaige()
.clickLogin()
.clickButtonLogin()
.compareText());
но падаю в
PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(5)), this);
ava.lang.IllegalArgumentException: Can not set io.appium.java_client.MobileElement field paige.TabBarPaige.login to org.openqa.selenium.remote.RemoteWebElement$$EnhancerByCGLIB$$d27c0df4
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
прошу помощи . Спасибо