swipe method not found

293 views
Skip to first unread message

codemutt

unread,
Jul 10, 2014, 5:00:28 PM7/10/14
to appium-...@googlegroups.com
I've got a test suite where I want to swipe a view. Using appium 1.1.0, iOS

start appium with appium &

Welcome to Appium v1.1.0 (REV e433bbc31511f199287db7724e1ce692bcb32117)

info: Appium REST http interface listener started on 0.0.0.0:4723


ruby code is like this:

forward_opts = {'start_x' => 140.0,
'start_y' => 130.0,
'end_x' => 40.0,
'end_y' => 130.0,
'duration' => 1.0}

...

#make sure we are on right page
wait = Selenium::WebDriver::Wait.new :timeout=>5
wait.until { @view = @driver.find_element(:name, "Weight") }

#swipe to next page
@driver.swipe(forward_opts)

output is this:

NoMethodError:
       undefined method `swipe' for #<Selenium::WebDriver::Driver:0x..f82fcb308f4ecd206 browser=:iOS>


The driver seems valid since it finds the element. 

Is there something wrong with the way I'm calling swipe?

Thanks

Vitalii Grygoruk

unread,
Jul 10, 2014, 5:41:03 PM7/10/14
to appium-...@googlegroups.com
You have to use Appium::Driver which is a part of https://github.com/appium/ruby_lib because pure webdriver doesn't have those "gesture" methods.
Message has been deleted

codemutt

unread,
Jul 10, 2014, 8:43:38 PM7/10/14
to appium-...@googlegroups.com
I think my code may be a bit unclear. So I restructured. How can the driver that I define as Appium::Driver as follows have an error message that says Selenium::WebDriver::Driver doesn't have the swipe method? Is Appium::Driver really a wrapper for Selenium::WebDriver::Driver (which I figure Appium::Driver at least uses -- but maybe it IS ...):

driver = Appium::Driver.new(desired_caps).start_driver
Appium.promote_appium_methods RSpec::Core::ExampleGroup
login = LoginView.new(driver)
login.get_elements
login.login(@user.id,@user.password)
forward_opts = {'start_x' => 140.0,
'start_y' => 130.0,
'end_x' => 40.0,
'end_y' => 130.0,
'duration' => 1.0}
driver.swipe(forward_opts)

Output:

NoMethodError:

       undefined method `swipe' for #<Selenium::WebDriver::Driver:0x..fba8e61e6bfc57172 browser=:iOS>

codemutt

unread,
Jul 10, 2014, 10:43:56 PM7/10/14
to appium-...@googlegroups.com
When I trace into driver.rb (appium_lib 4.0.0) I see that in fact there is not a method defined for swipe though the docs say it's there. And start_driver returns a Selenium::WebDriver instance. So the output I'm getting isn't a lie ;)

Is swipe not supported in Ruby at all? Does Appium support it in other languages? Is there a workaround?

codemutt

unread,
Jul 11, 2014, 12:53:29 PM7/11/14
to appium-...@googlegroups.com
To answer my own question: I read through the source and realized I needed to use TouchAction and set it all up to work with that.

Appium does all the right stuff after that but it still doesn't work, I think because of this:


Though I have looked pretty hard in the appium repo I can't find what Jonathan Lipps is referring to with "use mobile: scroll"; I can't tell if that is even valid for native iOS or not. If it is, can someone post a clear link to an example to make a page scroll from one view to the next view with mobile: scroll.

Thanks in advance.

Isaac Murchie

unread,
Jul 15, 2014, 2:07:33 PM7/15/14
to codemutt, appium-...@googlegroups.com


--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/d/optout.

codemutt

unread,
Jul 17, 2014, 4:56:47 PM7/17/14
to appium-...@googlegroups.com, codem...@gmail.com
Yes I had.

But in the app context I need to swipe between several different views, not a single view that needs to scroll to see all the elements.

Scroll functions seem limited (in my testing) to the confines of a single view. That is, I can't be on UIView1 and scroll_to UIView2  ... at least I wasn't able to make it work with any of the alternatives I found (scroll_to, scroll, dragInsideWithOptions, TouchAction).

What I am trying next is messing with the pageIndicator as soon as it gets properly implemented. Touching that in the right spot should flip the view to the next one.

I hope ;)
Reply all
Reply to author
Forward
0 new messages