weixin_39625098
weixin_39625098
2021-01-12 16:11

`tap()` Action fails although target item exists

i keep getting Reason: Action 'Tap' failed for tapping a UIButton subclass although target UIButton with the correct accessibilityId / accessibilityLabel exists and logged in window hierarchy dump after failure.

Runs on iPhone5 simulator, iOS 10.2 , EarlGrey V1.3.0

该提问来源于开源项目:google/EarlGrey

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

21条回答

  • weixin_39881760 weixin_39881760 4月前

    It worked, Thanks a lot!

    点赞 评论 复制链接分享
  • weixin_39958911 weixin_39958911 4月前

    Closing this issue. Please reopen if you encounter it again.

    点赞 评论 复制链接分享
  • weixin_39926042 weixin_39926042 4月前

    I have the same issue with an Azerty keyboard.

    点赞 评论 复制链接分享
  • weixin_39958911 weixin_39958911 4月前

    yes, i've sent you mine @ haitham.reda.com

    点赞 评论 复制链接分享
  • weixin_39832628 weixin_39832628 4月前

    Having the same issue in 1.4.0

    点赞 评论 复制链接分享
  • weixin_39777967 weixin_39777967 4月前

    , could you possibly send us some more info such as a log trace or so??

    点赞 评论 复制链接分享
  • weixin_39832628 weixin_39832628 4月前

    It doesn't happen every time, next time it does, I'll post!

    点赞 评论 复制链接分享
  • weixin_39798943 weixin_39798943 4月前

    I'm having a similar issue, that seems to disappear if I run the test with the animations slowed down in the simulator, with regular animations it's failing with this error:

    Exception Name: ActionFailedException Exception Reason: An action failed. Please refer to the error trace below. Exception with Action: { "Action Name" : "Tap", "Element Matcher" : "((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('loginButton'))" }

    Exception Details: Error Trace: [ { "Description" : "Cannot perform action due to a constraint failure.", "Domain" : "com.google.earlgrey.ElementInteractionErrorDomain", "Code" : "1", "File Name" : "GREYBaseAction.m", "Function Name" : "-[GREYBaseAction satisfiesConstraintsForElement:error:]", "Line" : "69", "TestCase Class" : "LoginTests", "TestCase Method" : "testLoginWithEmptyFieldsShouldFail" } ]

    Also, the test appears in a Mac with OS Sierra and Xcode 8.2, with a previous version of Xcode (7.3) seems to work fine.

    点赞 评论 复制链接分享
  • weixin_39777967 weixin_39777967 4月前

    -reda this seems extremely interesting, especially since it seems to be an Xcode 8.2 issue. Could you possibly repro this isssue with our FunctionalTests / Contrib / Demo projects please so that we could have a better look?

    点赞 评论 复制链接分享
  • weixin_39625098 weixin_39625098 4月前

    will give it a shot with Xcode 8.3B tomorrow and tell you if any difference.

    点赞 评论 复制链接分享
  • weixin_39798943 weixin_39798943 4月前

    sorry for the delay, here are the results for functional tests (I renamed from .log to .txt because github does not support .log) using Xcode Version 8.2.1 (8C1002) Session-EarlGreyFunctionalTests-2017-02-13_110829-UfTHHM.txt

    I had some problems with the other projects, I'll try to solve them and write the results.

    点赞 评论 复制链接分享
  • weixin_39777967 weixin_39777967 4月前

    what did you modify the animation speed to? This seems to affect almost every other test in our FunctionalTests which shouldn't happen normally.

    点赞 评论 复制链接分享
  • weixin_39798943 weixin_39798943 4月前

    I didn't modify it, I checked out the project and run it as it was on the repo.

    点赞 评论 复制链接分享
  • weixin_39958911 weixin_39958911 4月前

    This seems to happen on iOS 9.3, iPhone 5, Xcode 8.2.1 (if I am reading the logs correctly)

    From the logs it looks like a keyboard flake:

    
    Exception Details: Error Trace: [
      {
        "Description" : "Failed to type string 'test_user', because key [K] could not be found on the keyboard.",
        "Description Glossary" :     {
          "K" : "more, numbers"
        },
        "Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
        "Code" : "0",
        "File Name" : "GREYKeyboard.m",
        "Function Name" : "+[GREYKeyboard grey_setErrorForkeyNotFoundWithAccessibilityLabel:forTypingString:error:]",
        "Line" : "465",
        "TestCase Class" : "FTRAlertViewTest",
        "TestCase Method" : "testStyledAlertView"
      }
    ]
    

    Will https://github.com/google/EarlGrey/pull/327 address it?

    点赞 评论 复制链接分享
  • weixin_39777967 weixin_39777967 4月前

    These all do indeed look like flakes that https://github.com/google/EarlGrey/pull/327 should fix. Unfortunately, I've been unable to repro them on local runs. If I could get what animation value was modified, then I'd be able to debug them much better.

    点赞 评论 复制链接分享
  • weixin_39958911 weixin_39958911 4月前

    I think means to say that he didn't modify animation speed at all. It's regular speed (1.0). If you slow down animations on the simulator (using Command + T), the tests start passing. What's concerning is that 48 tests are failing whereas on our travis just a few 2-3 flake out time-to-time.

    点赞 评论 复制链接分享
  • weixin_39881760 weixin_39881760 4月前

    I have the same problem. seems If the keyboard is not English keyboard, It will fail. Also if the text is not English, like Chinese, It will also fail.

    So can I change keyboard type by EarlGrey?

    点赞 评论 复制链接分享
  • weixin_39958911 weixin_39958911 4月前

    Can you use a workaround grey_replaceText: action until we add support for Chinese keyboard?

    Alternatively you can start the app in different language by passing in the scheme the following argument: -AppleLanguages en or programmatically using:

    
    [[NSUserDefaults standardUserDefaults] setObject:@"fr" forKey:@"AppleLanguages"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    
    点赞 评论 复制链接分享
  • weixin_39958911 weixin_39958911 4月前

    hi -reda Can you provide the full error logs (censoring sensitive data) so we can analyze it?

    点赞 评论 复制链接分享
  • weixin_39777967 weixin_39777967 4月前

    Also, any reason why you're on EarlGrey 1.3.0?

    点赞 评论 复制链接分享
  • weixin_39625098 weixin_39625098 4月前

    hi , can i forward by Email instead please ?

    点赞 评论 复制链接分享

相关推荐