Missing elements in app source tree view

Hi Guys.

Need your help on this. I have a problem with missing elements in tree view. This is a react native application. They are displaying correctly in android but some are not showing up in IOS. When I changed my snapshotMaxDepth to 500, some are fixed but there are still some that is still not showing up.

Unfortunately due to NDA, I can only describe them and since I’m not an RN dev but tasked with adding the ids, pardon my explanation:

filterChip - there are 2 functions that uses filterChip
renderFilterChip - only has TouchableWithoutFeedback - this is where I added the ids and it works fine
renderFilterChipWithContainer - for styling purposes - it’s structure is
View
–> Animated.View
–> Surface
------> View
–> View
------> Call renderFilterChipWithContainer

If I change the code to renderFilterChip, the filterChip ids are showing in the appium inspector tree view (54 levels) but when renderFilterChipWithContainer is called, it stops at Animated.View (50th level)

normally such situation happens when there is lots of elements on screen. try minimize them (e.g. do not use long list with much data. use smaller instead).

Also you can try use inspector from xCode.

Thank you for that. Is there a settings to force appium to seek all elements in the tree? Element is ok in xcode inspector

43%20PM

I do not use appium GUI. Don’t know about elements search. But it should be enough to create search pattern in appium code using above screenshot.

I also tried doing getting all the text in runtime and it’s also not present.

  1. elements = driver.findElements(By.xpath("//*"))
  2. http://localhost:8100/source and it’s also not there.

Only xcode inspector can see it.

there is many tune settings in Appium to get page source just do not remember all.

try:

  1. print - driver.getPagesource()
  2. try -
driver.executeScript("mobile: source", ImmutableMap.of("format", "description"));
  1. http://appium.io/docs/en/advanced-concepts/settings/ -> ignoreUnimportantViews, includeNonModalElements, …
  1. driver.getPagesource() - Did not expand Animated.View
<XCUIElementTypeOther type="XCUIElementTypeOther" name="Animated.View" label="Animated.View" enabled="true" visible="true" x="0" y="180" width="414" height="65" index="2"/>
<XCUIElementTypeOther type="XCUIElementTypeOther" name="renderBody" label="renderBody" enabled="true" visible="true" x="0" y="197" width="414" height="620" index="3">
  1. driver.executeScript(“mobile: source”, ImmutableMap.of(“format”, “description”));

Other, 0x600002347100, {{0.0, 180.0}, {414.0, 65.0}}, label: ‘Animated.View’
Other, 0x600002346ae0, {{0.0, 197.0}, {414.0, 620.0}}, identifier: ‘renderBody’, label: ‘renderBody’

  1. ignoreUnimportantViews, includeNonModalElements - Still not showing the chipFilter

no luck. use xcode for a while…

How to traverse and access the elements (like get the label value etc) from the object returned by driver .executeScript(“mobile: source”, ImmutableMap. of (“format”, “description”));

you mean get element attribute?

el.getAttribute(attribute)

where ‘attribute’ e.g. for iOS can be:

  • value (this is element text)
  • label (sometimes element text only in label)
  • name (this is element ID actually)

No,

Object obj = driver .executeScript(“mobile: source”, ImmutableMap. of (“format”, “description”));

Now if obj returns the following, how to access the controls like Contacts, Cancel, Search etc.

              RemotePlaceholder, 0x6000003e39c0, pid: 91701, {{0.0, 0.0}, {414.0, 896.0}}
                Other, 0x6000003e3aa0, {{0.0, 0.0}, {414.0, 896.0}}
                  Other, 0x6000003e3560, {{0.0, 54.0}, {414.0, 842.0}}
                    Other, 0x6000003e3020, {{0.0, 54.0}, {414.0, 842.0}}
                      Other, 0x6000003e3e20, {{0.0, 54.0}, {414.0, 842.0}}
                        Other, 0x6000003e3480, {{0.0, 54.0}, {414.0, 842.0}}
                          Other, 0x6000003e32c0, {{0.0, 54.0}, {414.0, 842.0}}
                            Other, 0x6000003e31e0, {{0.0, 54.0}, {414.0, 842.0}}
                              NavigationBar, 0x6000003e2680, {{0.0, 54.0}, {414.0, 108.0}}, identifier: 'Contacts'
                                Button, 0x6000003e33a0, {{12.0, 60.0}, {67.0, 44.0}}, label: 'Groups'
                                StaticText, 0x6000003e3100, {{171.0, 72.0}, {72.5, 20.5}}, label: 'Contacts'
                                Button, 0x6000003e2f40, {{341.0, 60.0}, {61.0, 44.0}}, label: 'Cancel'
                                SearchField, 0x6000003e2a00, {{20.0, 111.0}, {374.0, 36.0}}, label: 'Search', placeholderValue: 'Search'
                              Other, 0x6000003e2840, {{0.0, 54.0}, {414.0, 842.0}}
                                Other, 0x6000003e25a0, {{0.0, 54.0}, {414.0, 842.0}}

not sure. try use just logic.