calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

In iOS 11 it doesn't find navigation bar button by image name #1332

Closed dimat closed 7 years ago

dimat commented 7 years ago

In my view controller I have a navigation item with a bar button item that has image "close".

In iOS 10 and 9 it was possible to find it with the query "* marked: 'closeIcon'", however, in iOS 11 it doesn't work anymore.

If I run command tree from calabash console under iOS 10 simulator, I get the following:

...

      [UINavigationBar] [id:xxxxx.LoginView]
        [_UINavigationBarBackground]
          [UIImageView]
        [UINavigationButton] [label:close]
          [UIImageView] [id:close]

...

In iOS 11 simulator:

...

      [UINavigationBar] [id:xxxxx.LoginView]
        [_UIBarBackground]
          [UIImageView]
          [UIImageView]
        [_UINavigationBarContentView]
          [_UIButtonBarStackView]
            [_UIButtonBarButton]
              [_UIModernBarButton]
                [UIImageView]
        [_UIButtonBarButton]
          [_UIModernBarButton]
            [UIImageView]
...
tszpinda commented 7 years ago

The only way I was able to got around this was to add accessibilityIdentifier to the button. Hope this helps.

JoeSSS commented 7 years ago

yep I also can access elements by accessibilityIdentifier: e.g. "view:'_UIButtonBarButton' id:'compose-button'"

jmoody commented 7 years ago

This is not something we can fix. In previous iOS version, the image name was available. It is not available in iOS 11.