# Find element in bottom of screen

**URL:** <https://discuss.appium.io/t/find-element-in-bottom-of-screen/17117>\
**Category:** Support\
**Created:** [June 7, 2017, 2:44pm UTC](https://discuss.appium.io/t/find-element-in-bottom-of-screen/17117 "2017-06-07T14:44:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![1132](https://discuss.appium.io/letter_avatar_proxy/v4/letter/1/e99b99/32.png) [@1132](https://discuss.appium.io/u/1132)\
**Post date:** [June 7, 2017, 2:44pm UTC](https://discuss.appium.io/t/find-element-in-bottom-of-screen/17117/1 "2017-06-07T14:44:45Z")

</div>

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

Tried something like that

> touchAction.moveTo(someId);  
> Error:  
> java.lang.NullPointerException

Can someone help?

I initializad elements with PageFactory.initElements(driver, this);

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [June 7, 2017, 3:14pm UTC](https://discuss.appium.io/t/find-element-in-bottom-of-screen/17117/2 "2017-06-07T15:14:07Z")

</div>

> [@1132](#):
>
> ((RemoteWebElement) someId).getId());

→

((MobileElement) your\_element).getId());

---

<div class="post-metadata">

**Author:** ![1132](https://discuss.appium.io/letter_avatar_proxy/v4/letter/1/e99b99/32.png) [@1132](https://discuss.appium.io/u/1132)\
**Post date:** [June 7, 2017, 6:51pm UTC](https://discuss.appium.io/t/find-element-in-bottom-of-screen/17117/3 "2017-06-07T18:51:49Z")

</div>

With ((MobileElement) your\_element).getId()) i have next error

> java.lang.IllegalArgumentException: Can not set io.appium.java\_client.MobileElement field elements.FilterElements.MyElement to com.sun.proxy.$Proxy11

Same thing.

> @FindBy(id = “element”)  
> private WebElement MyElement;

Constructor

> 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

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [June 8, 2017, 8:37am UTC](https://discuss.appium.io/t/find-element-in-bottom-of-screen/17117/4 "2017-06-08T08:37:54Z")

</div>

update page to:

```auto
    public Page(WebDriver driver) {
        this.driver = driver;
        PageFactory.initElements(new AppiumFieldDecorator(driver, default_time_in_sec, TimeUnit.SECONDS), this);
    }

```

---

<div class="post-metadata">

**Author:** ![1132](https://discuss.appium.io/letter_avatar_proxy/v4/letter/1/e99b99/32.png) [@1132](https://discuss.appium.io/u/1132)\
**Post date:** [June 8, 2017, 9:12am UTC](https://discuss.appium.io/t/find-element-in-bottom-of-screen/17117/5 "2017-06-08T09:12:14Z")

</div>

> public FilterElements(WebDriver driver) {  
> this.driver = driver;  
> PageFactory.initElements(new AppiumFieldDecorator(driver, 100, TimeUnit.SECONDS), this);  
> }

But:

> java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;J)V

> 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
