Using findElement(By.id) for iOS testing

2,306 views
Skip to first unread message

Marius Bob

unread,
Aug 26, 2013, 11:31:17 AM8/26/13
to appium-...@googlegroups.com

Is it possible to use findElement(By.id) for testing the iOS apps?

As I noticed only findElement(By.name) works…(it find the accessibility label)…

 

I’m trying to figure out how to test the same app implemented for both platforms Android and iOS by using the same steps implementation..…as for Android it works very well by finding the element’s ID….

bootstrap online

unread,
Aug 26, 2013, 11:45:48 AM8/26/13
to Marius Bob, appium-...@googlegroups.com
Not yet.
> --
> 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/groups/opt_out.

Jonathan Lipps

unread,
Aug 27, 2013, 5:42:42 PM8/27/13
to bootstrap online, Marius Bob, appium-...@googlegroups.com
Nor in the foreseeable future for iOS: iOS doesn't expose "id". Do you even have a set of ids for elements in iOS? I've never seen this in apps I've looked at.

bootstrap online

unread,
Aug 27, 2013, 5:45:36 PM8/27/13
to Jonathan Lipps, Marius Bob, appium-...@googlegroups.com
There was a presentation at Selenium Conf on how to do this using
localizable.strings.

Jonathan Lipps

unread,
Aug 27, 2013, 5:51:16 PM8/27/13
to bootstrap online, Marius Bob, appium-...@googlegroups.com
Yes, I guess I think of that more as find by text or label, only it happens to do the translation for you.

bootstrap online

unread,
Aug 27, 2013, 5:53:03 PM8/27/13
to Jonathan Lipps, Marius Bob, appium-...@googlegroups.com
It's the same as strings.xml on Android.

christian...@mysugr.com

unread,
Oct 21, 2013, 5:36:16 AM10/21/13
to appium-...@googlegroups.com
We are currently evaluating appium to test our Android and iOS apps with (in best case) the same tests. We have our apps in various languages, so accessing buttons with the name (like accessibility label) does not seem appropriate. It would rather be better to access it by the ID (accessibility ID for iOS and resource ID for Android) with the same method. As far as I understand, this is not possible. Is there a best practice how to write the same test for Android and iOS which also works with internationalisation?  
Thx

bootstrap online

unread,
Oct 21, 2013, 9:25:02 AM10/21/13
to christian...@mysugr.com, appium-...@googlegroups.com
On Mon, Oct 21, 2013 at 5:36 AM, <christian...@mysugr.com> wrote:
> Is there a best practice how to write the same test for Android and iOS
> which also works with internationalisation?

Yes, use the accessibility tags. On iOS it's name or label. On Android
it's content description or resource id.

christian...@mysugr.com

unread,
Oct 21, 2013, 2:41:43 PM10/21/13
to appium-...@googlegroups.com, christian...@mysugr.com
Hello!

The issue with the accessibility tags (name or label) is that it is not unique when having the same app in different languages. The resourceID in Android is unique, therefore a testcase can be written to work in each app language. The accessibility ID in iOS would be unique as well (not the name or label) and I don`t know how to handle this issue. Is there a best practice or how can this be handled? Thanks a lot!

bootstrap online

unread,
Oct 21, 2013, 2:46:25 PM10/21/13
to christian...@mysugr.com, appium-...@googlegroups.com
You set the accessibility tags so if it's not unique then fix it.
Reply all
Reply to author
Forward
0 new messages