How to drag or swipe a button on a screen using calabash-android

3 209 zobrazení
Přeskočit na první nepřečtenou zprávu

Preeti Jindal

nepřečteno,
19. 8. 2014 9:20:5919.08.14
komu: calabash...@googlegroups.com

I have to swipe a button on screen. That is dragging a button from one position to another (Swipe buttons as in iPhone)

1. I am using calabash-android version 0.4.21
2. I have used following code to swipe a button:

performAction('drag_coordinates',30,90,80,80,10)                   //  numbers reflect the percentage and not exact coordinates

I have also tried exact coordinates of the button on screen:

performAction('drag_coordinates',300,450,1035,1035,10)       //  numbers reflect the exact coordinates

3.  performAction('swipe', 'right') 

This would not work as t will swipe the entire screen and I have to swipe a particular button.

Can anybody help me out because I am not finding anything on this online.
I really need help here!!!!

Thanks in advance.





Sanjay Kumar

nepřečteno,
19. 8. 2014 11:44:1019.08.14
komu: calabash...@googlegroups.com
Try this : perform_action('drag', from_x, to_x, from_y, to_y, steps)


--
You received this message because you are subscribed to the Google Groups "calabash-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to calabash-andro...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tobias....@xamarin.com

nepřečteno,
27. 8. 2014 11:33:3327.08.14
komu: calabash...@googlegroups.com
With the release of generic multi touch gestures (calabash-android 0.5.2), you could do something like this:

# At the top of your features file
include
Calabash::Android::Gestures
#...


Given(/^.....$/) do
  gesture
= Gesture.tap(time: 0.5, release: false).merge(Gesture.tap(wait: 0.5))
  gesture
.gestures.first.touches.first.query_string = "* id:'first_element*"
  gesture
.gestures.first.touches[1].query_string = "* id:'second_element'"
  execute_gesture
(gesture)
end

If you want to swipe from a certain point to a certain point in the same element you can simple do

pan("* id:'element'", :right)

or set your own coordinates using

pan("button", :right, from: {x: 0, y: 50}, to: {x: 100, y:50}) # Swipe from absolute center left to absolute center right

Tejasvi Manmatha

nepřečteno,
22. 1. 2015 9:20:0422.01.15
komu: calabash...@googlegroups.com
Thanks so much pan functionality was very useful

Praveen Reddy

nepřečteno,
22. 1. 2015 10:18:3822.01.15
komu: calabash...@googlegroups.com

Hi,

How can you swipe a button? Find out the view and the class of that object using calabash-android console or uiautomatorviewer, then you can perform the gesture.

Thanks,
PV

Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv