Hello.
I am just start work with appium, and i have some problem
( starting android automation tests)
With annotation @FindBy(id = “someId”) works correctly only for element displayed on the screen.
I tried to fix it with
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap scrollObjects = new HashMap();
scrollObjects.put(“direction”, “down”);
scrollObjects.put(“element”,
((RemoteWebElement) someId).getId());
js.executeScript(“mobile: scrollTo”, scrollObjects);
Error:
java.lang.ClassCastException: com.sun.proxy.$Proxy11 cannot be cast to
org.openqa.selenium.remote.RemoteWebElement
public FilterElements(AndroidDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
basePage = new BasePage(driver);
}
If i try do
@AndroidFindBy(id = “element”)
private MobileElement MyElement;
Error:
java.lang.IllegalArgumentException: Can not set io.appium.java_client.MobileElement field elements.FilterElements.element to com.sun.proxy.$Proxy11
at io.appium.java_client.pagefactory.TimeOutDuration.setTime(TimeOutDuration.java:54)
at io.appium.java_client.pagefactory.TimeOutDuration.setTime(TimeOutDuration.java:59)
at io.appium.java_client.pagefactory.TimeOutDuration.(TimeOutDuration.java:37)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.(AppiumFieldDecorator.java:80)
I work on emulator
Element in bottom of page initialize like Proxy element for: DefaultElementLocator ‘By.id: button’
And i can’t scroll\click on it