This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 4
Dec 2017

Hi,

I tried below code to scroll element to up but it is not working. Please help me on this.
Here “element” variable refers to my target element and it is identifiable and return by driver.findElement.

HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("element", ((RemoteWebElement)element).getId());
scrollObject.put("direction", "up");
driver.executeScript("mobile: scroll",scrollObject);

Along with the above code I tried below ways as well.

  1. driver.executeScript(“mobile: scrollTo”,scrollObject);
  2. new IOSTouchAction(driver).press(element).moveTo(anotherElement).release().perform();

Below is my Environment:
Framework: XCUITest
Xcode: 8.3.3
Appium : v1.7.2-beta2
iPad iOS version: 10.3.3
io.appium.java-client api version: 5.0.4

Thanks,
Ramesh Sriram

  • created

    Dec '17
  • last reply

    Dec '17
  • 3

    replies

  • 597

    views

  • 3

    users

  • 5

    links

Hi Vikram,

Thanks for your response.

As per the Post, I tried Method1(Mobile: swipe) and Method2(Mobile: scroll) but did not find any response from iPad screen. Also with Co-Ordinates (Mobile: scroll) way.

But I saw little scrolling when I use Co-Ordinates (Mobile: swap) way and it is not resolving my requirement.

My Requirement:
There are 100 elements one of one and 10 elements fits into one complete screen. When I want 80th element, I need to scroll up 80 elements to view my target element.

  • Touch Action scrolling working, but the limitation is I can scroll upto one screen at a time(after move, I can see 11 to 20 elements in the screen)

new TouchAction(driver).press(278, 861).waitAction(Duration.ofMillis(100)).moveTo(0, 800-targetElementPoint.y).release().perform();

Below are the appium logs:

  1. [debug] [MJSONWP] Calling AppiumDriver.execute() with args: [“mobile: swipe”,[{“element”:“E2414132-1E87-4F59-8683-00025D334C38”,“direction”:“up”}],“5f598492-99c2-4bdf-bd60-4f1598363083”]
    [debug] [XCUITest] Executing command ‘execute’
    [debug] [JSONWP Proxy] Proxying [POST /wda/element/E2414132-1E87-4F59-8683-00025D334C38/swipe] to [POST http://localhost:8100/session/0F9D6374-22BF-4610-A402-DDB5E5F8B8F8/wda/element/E2414132-1E87-4F59-8683-00025D334C38/swipe] with body: {“direction”:“up”}
    [debug] [JSONWP Proxy] Got response with status 200: {“value”:{},“sessionId”:“0F9D6374-22BF-4610-A402-DDB5E5F8B8F8”,“status”:0}
    [debug] [MJSONWP] Responding to client with driver.execute() result: {}
    [HTTP] <-- POST /wd/hub/session/5f598492-99c2-4bdf-bd60-4f1598363083/execute 200 9390 ms - 74

  2. [debug] [MJSONWP] Calling AppiumDriver.execute() with args: [“mobile: scroll”,[{“toVisible”:“true”,“element”:“E2414132-1E87-4F59-8683-00025D334C38”,“direction”:“down”}],“5f598492-99c2-4bdf-bd60-4f1598363083”]
    [debug] [XCUITest] Executing command ‘execute’
    [debug] [JSONWP Proxy] Proxying [POST /wda/element/E2414132-1E87-4F59-8683-00025D334C38/scroll] to [POST http://localhost:8100/session/0F9D6374-22BF-4610-A402-DDB5E5F8B8F8/wda/element/E2414132-1E87-4F59-8683-00025D334C38/scroll] with body: {“direction”:“down”}
    [debug] [JSONWP Proxy] Got response with status 200: {“value”:{},“sessionId”:“0F9D6374-22BF-4610-A402-DDB5E5F8B8F8”,“status”:0}
    [debug] [MJSONWP] Responding to client with driver.execute() result: {}
    [HTTP] <-- POST /wd/hub/session/5f598492-99c2-4bdf-bd60-4f1598363083/execute 200 4300 ms - 74

3.[debug] [MJSONWP] Calling AppiumDriver.execute() with args: [“mobile: scroll”,[{“duration”:“2000”,“endY”:“661”,“endX”:“278”,“startY”:“861”,“startX”:“278”,“direction”:“down”}],“5f598492-99c2-4bdf-bd60-4f1598363083”]
[debug] [XCUITest] Executing command ‘execute’
[debug] [BaseDriver] Waiting up to 30000 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/0F9D6374-22BF-4610-A402-DDB5E5F8B8F8/element] with body: {“using”:“class name”,“value”:“XCUIElementTypeApplication”}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:{“ELEMENT”:“FC86E588-8619-43E2-B66A-5EBA673E31DE”},“sessionId”:“0F9D6374-22BF-4610-A402-DDB5E5F8B8F8”,“status”:0}
[debug] [JSONWP Proxy] Proxying [POST /wda/element/FC86E588-8619-43E2-B66A-5EBA673E31DE/scroll] to [POST http://localhost:8100/session/0F9D6374-22BF-4610-A402-DDB5E5F8B8F8/wda/element/FC86E588-8619-43E2-B66A-5EBA673E31DE/scroll] with body: {“direction”:“down”}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:{},“sessionId”:“0F9D6374-22BF-4610-A402-DDB5E5F8B8F8”,“status”:0}
[debug] [MJSONWP] Responding to client with driver.execute() result: {}
[HTTP] <-- POST /wd/hub/session/5f598492-99c2-4bdf-bd60-4f1598363083/execute 200 21059 ms - 74