Appium doesn't detect cells in tableview

Sorry for newbie in question. I am trying to move my automatic tests on iOS from UIAutomation to Appium/Java/TestNG, using Appium 1.2.2.
In the iOS application there is invisible tableview that being displayed after tapping on some button.

When recording the click within apple Instruments tool the following line is being recorded:
target.frontMostApp().mainWindow().tableViews()[“repositoryTableView”].visibleCells()[“XXX”].tap();

However, the content of “repositoryTableView” is not visible in neither Appium inspector or test. In xml tree the “repositoryTableView” tableview also exist without cells:

This problem currently stops me , please help

1 Like

Hello,

I have seen similar things. The problem seems to setm from accessibility settings for the elements.

Are you setting accessibilityIdentifiers for the elements?
Are you setting isAccessibilityElement to YES (true) for each element?

Try set the above if you are not as that generally solves the issue for me.

Note I have also see table cells not show up in the inspetor if the table itself had the isAccessibilityElement value set to YES (true). But this doesn’t a;lways seem to be the case.

Additionally if you want to get the text value of an element e.g. a label. Sometimes this will not show up if the value was set dynamically. I have found setting the accessibilityValue to the text value resolves that.

Regards,
Tristan

Thanks a lot for your reply,

I tried to play with accessibilityIdentifiers, for some reason it didn’t help, maybe I didn’t do enough tests.
I managed to solve it with findElementByIosUIAutomation(target.frontMostApp().mainWindow().tableViews()[“repositoryTableView”].visibleCells()[“XXX”]) function.

I’m sorry to bump this thread. We’re stuck with the same issue on iOS.
I’m inspecting a screen with table rows just like the original author postulated.
Expected: The table rows (in this case) with course information is shown.
Actual: No table row information is shown. Only a count (like rows 1 to 4 of 11) where 5-11 are offscreen. See screen shot below.
Appium Version: 1.3.4

Notes:

  1. I’m also attaching the JSON that occurs when doing arc
  2. It looks like the UIATableCells are set to invisible.
  3. Also according to the inspector logs, it seems like the overarching UIATableView is also invisible.
  4. When Inquiring this to our development team, the response was:
    “in iOS UITableView, cell view is reused, that means only visible cell is useful, all invisible cell could be in incorrect state. You cannot use the data in invisible cell.”

Any particulars of objective C setaccessibilityIdentifier logic would be wonderful. Not sure of others have encountered this.

Thanks in advance!
Eric

JSON:


                        "name":"Document Viewing 101",
                        "type":"UIATableCell",
                        "label":null,
                        "value":"",
                        "rect":{  
                           "origin":{  
                              "x":0,
                              "y":182
                           },
                           "size":{  
                              "width":320,
                              "height":86
                           }
                        },
                        "dom":null,
                        "enabled":true,
                        "valid":true,
                        "visible":false,
                        "children":[  
                           {  
                              "name":"Document Viewing 101",
                              "type":"UIAStaticText",
                              "label":"Document Viewing 101",
                              "value":"Document Viewing 101",
                              "rect":{  
                                 "origin":{  
                                    "x":66.5,
                                    "y":196.5
                                 },
                                 "size":{  
                                    "width":226.5,
                                    "height":18
                                 }
                              },
                              "dom":null,
                              "enabled":true,
                              "valid":true,
                              "visible":false,
                              "children":[  

                              ],
                              "hint":null
                           },

Image:

I had to add the last line below in the source to get the tables to show. The first 3 lines were already in there:

  • (UITableView *)tableView {
    UIView *superview = self.superview;
    UITableView *tableView = nil;
    tableView.isAccessibilityElement=YES;

Hi Guys,
I am facing a similar issue with one of my table views. I dont have issue with other tableview. This is more identical with the original question in this thread. The tableview is a SideMenu which is not visible when app is loaded. It shows up only when the side menu toggle button is clicked like we see in Facebook or gmail applications. I am sure that this has nothing to do with setting accessibility Identifers,

Consider these two cases,
I start the app and when side menu is invisible I launch Appium inspector, Now I see the view without side menu open. Now I click toggle button in app to open Side Menu and refresh the view in inspector. I can see the Side Menu view but the entire TableView is displayed as a single item, none of the cells are accessible.

Second Case, I start the app. Open the side menu and now launch Appium inspector. The side menu is Visbile and all the cells inside the tableview are accessible.

So i think it happens only for tableviews which are initially hidden and then later dynamically made visible. Given all the accessibility Identifiers are set.

Hey there Zach
Thanks for the post.
So it sounds like you hit a timing where refreshing the appium inspector after revealing the sidebar still shows said sidebar items as hidden.

A couple of questions:

  1. Are you firstly starting up arc and then launching the inspector magnifying glass icon? Or are you configuring and running appium all through the inspector client. I recommend the former.
  2. Assuming you do run arc, do you see the same hidden results? You can do find_element(:id, my_element).displayed? In arc to verify
  3. Assuming 2 is yes, what happens after waiting say 2 seconds and running the command above again?
  4. Assuming 3 is the same, then you may have uncovered a bug. I would file on GitHub.
    Otherwise, it may be a timing issue. In this case, I’d recommend adding an explicit wait

Let me know how it goes

Appium has no problem on it.
The main problem is that the timeout setting before executing a new command is not enough.
I suggest to insert a delay after the …tableview… command.

sample:
int seconds = value you expected;
((JavascriptExecutor)driver).executeScript(“UIATarget.localTarget().delay(”+seconds+")");

this might help
https://developer.apple.com/documentation/objectivec/nsobject/1615141-isaccessibilityelement