Problem with identification of androidelement

Mobile Testing, Android App Testing.
cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Problem with identification of androidelement

Post by cwirek » Tue Jan 28, 2014 9:33 am

Hi,

I have a problem with identification of element in Sync Mobile application.
When I use Ranorex Spy, it recognizes element correctly (AndroidElement 'android.webkit.WebTextView'),
but when I play recorded test, Ranorex finds another element for this RxPath:

Code: Select all

/mobileapp[@title='alior.bankingapp.android']/form[@title='FragmentHolderActivity']/container[@rid='content']//container[@containertype='Relative']/?/?/androidelement
Ranorex finds ProgressBar instead of AndroidElement 'android.webkit.WebTextView', like in the attached screenshot.
I also attach a snapshot of element.

Kind regards,
Mirek
Attachments
sync.rxsnp
(187.84 KiB) Downloaded 133 times
sync.png
sync.png (10.57 KiB) Viewed 1489 times

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Problem with identification of androidelement

Post by krstcs » Tue Jan 28, 2014 2:20 pm

Your problem is that the RanoreXPath given does not uniquely identify the element you are trying to manipulate. The progress bar object is technically also an AndroidElement object, so "/androidelement" will find both.

You will need to add an attribute to the "/andoidelement" tag in order to make it unique.

Something like:

Code: Select all

/mobileapp[@title='alior.bankingapp.android']/form[@title='FragmentHolderActivity']/container[@rid='content']//container[@containertype='Relative']/?/?/androidelement[@id='android.webkit.WebTextView']
Of course, you will need to determine what attribute and what value you want to match.
Shortcuts usually aren't...

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Problem with identification of androidelement

Post by cwirek » Wed Jan 29, 2014 11:47 am

I used below RxPath:

Code: Select all

/mobileapp[@title='alior.bankingapp.android']/form[@title='FragmentHolderActivity']/container[@rid='content']//container[@containertype='Relative']/?/?/androidelement[@platformclass='android.webkit.WebTextView']
When I used Ranorex Spy, element was recognized and even I was even able to highlight it, but If I used user code

Code: Select all

AndroidElement element = "/mobileapp[@title='alior.bankingapp.android']/form[@title='FragmentHolderActivity']/container[@rid='content']//container[@containertype='Relative']/?/?/androidelement[@platformclass='android.webkit.WebTextView']";
I got an error:

Code: Select all

No element found for path '/mobileapp[@title='alior.bankingapp.android']/form[@title='FragmentHolderActivity']/container[@rid='content']//container[@containertype='Relative']/?/?/androidelement[@platformclass='android.webkit.WebTextView']' within 10s. 

User avatar
mebner
Posts: 61
Joined: Tue Dec 17, 2013 6:42 pm

Re: Problem with identification of androidelement

Post by mebner » Fri Jan 31, 2014 10:20 am

Hi,

You could try to increase the searchtimeout or to use a more specific RxPath like the following one:

Code: Select all

/mobileapp[@title='alior.bankingapp.android']/form[@title='FragmentHolderActivity']/container[@rid='content' and @containertype='Frame']/container[@containertype='Frame']/androidelement/container[@containertype='Frame']/container[@containertype='Relative']/androidelement/androidelement[@platformclass='android.webkit.WebTextView']
Regards,
Markus

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Problem with identification of androidelement

Post by cwirek » Fri Jan 31, 2014 10:50 am

Hi

I increased searchtimeout to 100s and Ranorex couldn't find element
I also used yours RxPath, the result was the same.
Maybe the problem is with the parent element ?

Code: Select all

androidelement[@platformclass='ind.bankingapp.android.framework.f.a']
Kind regards,
Mirek

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Problem with identification of androidelement

Post by cwirek » Tue Feb 11, 2014 1:10 pm

Anyone?
Application is on google play:

Code: Select all

https://play.google.com/store/apps/details?id=alior.bankingapp.android&hl=pl

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Problem with identification of androidelement

Post by Support Team » Thu Feb 13, 2014 4:59 pm

Hello Mirek,

We have tried to reproduce your issue, but it seems that there is another version of your application on the play-store.
Have you changed anything in this version?

Regards,

Markus (S)
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Problem with identification of androidelement

Post by cwirek » Tue Feb 25, 2014 7:41 am

HI,

I'm using version 2.1.3 of application.
Could You send me a source code with recorded script: enter login and click on Confirm (Zatwierdź) button

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Problem with identification of androidelement

Post by Support Team » Wed Feb 26, 2014 4:05 pm

Hello cwirek,

Unfortunately the button (Zatwierdź) is not recognized as a button.
Also the Set Value on the textfield (AndroidWebkitWebTextView) is not working correctly.

All other actions in the table are recorded correct (Button 'Zaloguj' and Button 'OK') as you can see in the attached screenshot.
SyncmobileScreen.png
SyncmobileScreen.png (57.89 KiB) Viewed 1368 times
Kind regards,

Markus(S)
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Problem with identification of androidelement

Post by cwirek » Thu Feb 27, 2014 11:44 am

Hello Markus,

Could You attached recorded project?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Problem with identification of androidelement

Post by Support Team » Mon Mar 03, 2014 3:40 pm

Hello cwirek,

Here is my recorded project. Please change the global paramter (Device) to your devicename in order to run the TestSuite successfully.

Kind regards,

Markus (S)
Attachments
SyncMobile.zip
Solution SyncMobile
(3.58 MiB) Downloaded 112 times
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Problem with identification of androidelement

Post by cwirek » Tue Mar 11, 2014 11:14 am

Thx for source code

rkamboj
Posts: 1
Joined: Fri Mar 28, 2014 2:45 am

Re: Problem with identification of androidelement

Post by rkamboj » Fri Mar 28, 2014 2:53 am

I am also having the same kind of problem. I am trying to set the date in the android element and unable to do that. Can you please provide the solution how to change the string date in Android element.

Pop UP form:: /form[@title='Date of Birth']

Android element:: /form[@title='Date of Birth']/container[@rid='content']/container/container[@containertype='Frame']/container[@rid='custom']/androidelement/container[@containertype='Linear']/container[@containertype='Linear']/androidelement

Android Element Platform class:: /form[@title='Date of Birth']/container[@rid='content']/container/container[@containertype='Frame']/container[@rid='custom']/androidelement/container[@containertype='Linear']/container[@containertype='Linear']/androidelement[@platformclass='android.widget.NumberPicker']
Attachments
Query.png
Query.png (74.58 KiB) Viewed 1291 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Problem with identification of androidelement

Post by Support Team » Thu Apr 03, 2014 2:54 pm

Hi rkamboj,
In order to change the text of an android text element perform a “Set Value” action on this element within a RecordingModule or if you are using a CodeModule use the SetAttibuteValue()-Method.
For example:

Code: Select all

repository.element.SetAttributeValue(“Text”, “YOURTEXT”);
Kind regards,
Markus (S)
.
Image