Unable to swipe from left->right on webElement in hybrid app

Mobile Testing, Android App Testing.
MattDonCDN
Posts: 7
Joined: Tue Mar 28, 2017 7:51 pm

Unable to swipe from left->right on webElement in hybrid app

Post by MattDonCDN » Wed Mar 29, 2017 4:08 pm

Hi,

I'm trying to automate a hybrid mobile app build on the cordova framework. We have webElements that can be swiped from right to left to expose buttons on the right side of the element.

If I attempt to use the Swipe Gesture action on this webelement a 'Specified method is not supported' error is returned.

I attempted to use the TouchMove, TouchStart and TouchEnd actions as well with no success. I've attempted to do these via a user coded step as well using x,y co-ordinates, Location, etc.

I was able to swipe this exact same webElement using a different mobile automation framework so I'm fairly confident I'm on the right target element. But to be thorough, I've attempted to do these same actions on surrounding and contained elements in the dom. Nothing I try is working.

I can supply an .apk if anyone is willing to take a look and see if there is anything that can be done here. This action is critical to successful automation of our application.

Any help is greatly appreciated!
Thanks,
Matt

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Unable to swipe from left->right on webElement in hybrid app

Post by asdf » Thu Mar 30, 2017 2:03 pm

Hi Matt,

May I ask you to share a snapshot of your application under test with us? Furthermore, please let me know on which element you tried the swipe-action and your exact Ranorex version.

MattDonCDN
Posts: 7
Joined: Tue Mar 28, 2017 7:51 pm

Re: Unable to swipe from left->right on webElement in hybrid app

Post by MattDonCDN » Thu Mar 30, 2017 3:28 pm

Hi asdf,

I've uploaded the snapshot of the AUT. The element I'm trying to swipe can be found at this path in the snapshot:
/mobileapp[@title='com.shs.ArialMobile']/form[@title='MainActivity']/?/?/dom[@contentdescription='Web View']/body/tag[@tagname='ion-nav-view']/?/?/tag[@tagname='ion-nav-view']/tag[@tagname='ion-view']/tag[@tagname='ion-content']/div[1]/tag[@tagname='ion-list']/div/div/tag[1]

As mentioned I've also tried to swipe (and touch start/end) on items in the child div 'item-content' without success.

Ranorex version is 6.2.1 running on Windows 2012 R2 64bit server. .NET Runtime Version: 4.0.30319.42000.

Thanks again!
Matt
You do not have the required permissions to view the files attached to this post.

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Unable to swipe from left->right on webElement in hybrid app

Post by asdf » Fri Mar 31, 2017 11:40 am

Hi Matt,

In order to get your swipe working, please try the following approach.
1. Add the MainActivity of your application to your repository.
MainActivity.png
2. Add a swipe action on the MainActivity to your recording.
Swipe.png
3. Set the swipe direction to right/left.
4. Set the start location of the swipe action, according to your element which you want to swipe.
StartLocation.png
Since the object you want to swipe is not in the center of the MainActivity, you have to set the coordinates of your element accordingly. The coordinates could be found in the attributes of the specific element.

Hope this helps.

Kind regards,
asdf
You do not have the required permissions to view the files attached to this post.

MattDonCDN
Posts: 7
Joined: Tue Mar 28, 2017 7:51 pm

Re: Unable to swipe from left->right on webElement in hybrid app

Post by MattDonCDN » Fri Mar 31, 2017 4:05 pm

Thank you kindly asdf! That worked and was enough to get me moving forward!

Since there will be multiple elements in the list I'd like to swipe in this manner and their location could be changing I will need to write some user code to dynamically calculate the element's coordinates relative to the Main Activity so it works across different device screen sizes.

It seems like a bug that I can't do the Swipe action directly on the WebElement to save all this trouble. I'll see if I can report this.

Thanks again,
Matt

Grenther
Posts: 2
Joined: Wed Jul 05, 2017 12:25 pm

Re: Unable to swipe from left->right on webElement in hybrid app

Post by Grenther » Wed Jul 05, 2017 1:15 pm

Hi Matt,

Have you been able to solve the issue regarding the multiple elements in a list and different screen sizes?
I'm in the same situation and would really not like to go through the trouble of inventing the wheel if you've already done so.

MartinKubal
Posts: 10
Joined: Wed Aug 16, 2017 8:16 pm

Re: Unable to swipe from left->right on webElement in hybrid app

Post by MartinKubal » Wed Sep 20, 2017 8:50 am

Grenther wrote:Hi Matt,

Have you been able to solve the issue regarding the multiple elements in a list and different screen sizes?
I'm in the same situation and would really not like to go through the trouble of inventing the wheel if you've already done so.
Hi, we were solving the same issue. Only chance is to use user code, where first you need to find out coordinates for element, use it as a variable and then make it as area for swipe gesture on a form wich allows you use swipe.

Code: Select all

public void Swipe_Gesture_YourNameOfUserCode(RepoItemInfo formInfo, RepoItemInfo argument1)
        {
        	int x = Your.Exact.Path.To.Repository.Item.Element.ScreenLocation.X;
        	int y = Your.Exact.Path.To.Repository.Item.Element.ScreenLocation.Y;
  
			string loc = x + ";" + y;

            Report.Log(ReportLevel.Info, "Touch Gestures", "Swipe gesture with direction 'Down (90°)' starting from 'x:"+x +";y:"+y+"' with distance '.05' with swipe duration'500ms' and step count '0' on item 'formInfo'.", formInfo);
            formInfo.FindAdapter<Form>().Swipe(loc, ValueConverter.ArgumentFromString<Ranorex.Core.Recorder.Touch.GestureDirection>("SwipeDirection", "Down (90°)"), ValueConverter.ArgumentFromString<Ranorex.Core.Distance>("Distance", ".05"), ValueConverter.ArgumentFromString<Ranorex.Duration>("SwipeDuration", "500ms"), 0);
			
			       
        }

You will then edit Distance, Direction etc. according to your needs...

I know there may be more elegant solution to this problem, but I have actually no experience with coding, so I am glad I was able to solve this and it is working.