Scroll To / Swipe Action in iOS 8


#1

I am using Appium 1.3.5 and java client,

When i tried using scrollTo in iOS webView,got the below error message
ElementsAction.driver.scrollTo(“Policy”);
(OR)
ElementsAction.driver.swipe(622, 693,606, 258, (int) 0.5);

“Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 6 milliseconds”

Appium Logs:

info: [debug] Responding to client that a method is not implemented
info: <-- POST /wd/hub/session/9fdbe097-6b7d-491e-ac3e-bd03a88fae59/touch/perform 501 0.961 ms - 158

My requirement:
Need to scroll until a element is found and should click on it,in webView,in java.

Kindly help.
Thanks


#2

Hi @Mobile_Test_Test,

You might have to switch to native context.

Thanks,
Sujata


#3

Oops!
i forgot to say that i have already switched to webview successfully.
But still not able to swipe


#4

Hi,
I believe driver.scrollTo(“Policy”); is enough instead of ElementsAction.driver.scrollTo(“Policy”);
and have a try with scrollToExact(“Policy”); also.

Regards,
Bhaskar.


#5

its my framework exclude that…
i tried driver.scrollTo(“Policy”) its not working…


#6

@bhaskar @sujata_kalluri

Guys could you put some focus on this?


#7

Hi @Mobile_Test_Test ,

1)Have you ever tried with Co-Ordinates…?
driver.swipe(int x,int y ,…);
2)If it doesn’t work with scrollTo() then go with swipe with element…
IOSElement element = (IOSElement) driver.findElement(locator);
element.swipe(SwipeElementDirection.DOWN);
(Note: you can use MobileElement instead of IOSElement and please make sure that element should be displayed).

Hope this helps :wink:

Regards,
Vijay Bhaskar.


#8

Hi @Mobile_Test_Test,

scrollTo will work if you move to native context. It will not work when you are in webview context, so the error “not yet implemented”.

Please try to move to native context and scroll to necessary text.

Thanks,
Sujata


#9

@sujata_kalluri i figured out a way to scroll the WEbview using javascript executor.

Anyways for native have u tried scrollTo in java and is it working?
can u provide a sample code snippet if available?


#10

Hi @Mobile_Test_Test,

I used below with a native iOS app:

((IOSDriver)driver).scrollTo(text);

where driver is WebDriver instance.

You can directly use IOSDriver or AndroidDriver as required.

Thanks,
Sujata


#11

@sujata_kalluri i tried the same and its not working… Element not found/not implemented is what is get as an error.

Im trying to scroll a tableView basically.

P.S… Im in native view and trying to scroll a native element only


#12

Is that element having name attribute and containing text as the same you have given…?

Please let me know…!!!

Regards,
Bhaskar.


#13

Exactly @bhaskar … It has a name attribute and i have given the same… Still its not working…


#14

Hi @Mobile_Test_Test,

scrollTo might not work on TableView.

Thanks,
Sujata


How to scroll in Appium using python
#15

Okie any workaround for that?


#16

You can use Javascript Executor to scroll to a position on the screen

Thanks,
Sujata


#17

Using native_app context here, and I still get the message “Not yet implemented” when trying to scroll left/right with javascript executor.

In our case, we cannot scroll to text because it is a horizontal row of images buttons with no text. I just need to scroll to last item listed on the far right.

Using latest appium 1.4.1 and java client 2.2.0.

Am I doing something wrong?

Using doc provided via the docs:
Of course with my own different coordinate points, but pretty much directly as per the doc.

JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, Double> swipeObject = new HashMap<String, Double>();
swipeObject.put(“startX”, 0.95);
swipeObject.put(“startY”, 0.5);
swipeObject.put(“endX”, 0.05);
swipeObject.put(“endY”, 0.5);
swipeObject.put(“duration”, 1.8);
js.executeScript(“mobile: swipe”, swipeObject);


#18

Hey @sujata_kalluri

Why scrollTo might not work on UITableView when this is designed for?

In the documentation, I found that
`/**

  • Scroll to the element whose ‘text’ attribute contains the input text.
  • This scrolling happens within the first UIATableView on the UI. Use the method on IOSElement to scroll from a different ScrollView.
  • @param text input text contained in text attribute
    */`

It doesn’t work for me, so if you have a tip to use it, let me know.

Thanks,
Ben


#19

Hi @Benoit,

It would work in Native Context, i.e. when AndroidDriver or IOSDriver is used to call scrollTo method.

Could you let me know what error you are getting?

Thanks,
Sujata


#20

Hi @sujata_kalluri,

Actually I don’t have any error message. It just do nothing about it.
The top of the cell can be seen for like 20%, does Appium interprets that like “no need to scroll, it’s already displayed”?

Thanks,
Ben