Detox: Cannot click 'Done' on keyboard - solved

Created on 13 Nov 2017  路  6Comments  路  Source: wix/Detox

Description

Cannot click 'Done' on keyboard

Steps to Reproduce

After running tests I cannot move further because I can't click 'Done' button
I've tried https://github.com/wix/detox/issues/209
\n opened keyboard with pause / wait option.

 it('I want to Login', async () => {
        profileTabButton = element(by.id('profileTabButton'));
        singUp = element(by.text('Get started'));
        countryDropDown = element(by.id('country-dropdown-content'));
        countryChoose = element(by.text('+47'));
        phoneNumberField = element(by.type('RCTTextField'));

        await expect(profileTabButton).toBeVisible();
        await profileTabButton.tap();
        await expect(singUp).toBeVisible();
        await singUp.tap();
        await expect(countryDropDown).toBeVisible();
        await countryDropDown.tap();
        await countryChoose.tap();
        await phoneNumberField.tap();
        await phoneNumberField.typeText('10001234');
        await phoneNumberField.typeText('\n');
    });
})

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 5.93
  • Node: 7.10.1
  • Device: Iphone 6
  • Xcode: 9.0.0
  • macOS: 10.12.6

    Logs:

     Error: Error: Cannot find UI element.
Exception with Action: {
  "Action Name" : "Type '
'",
  "Element Matcher" : "((kindOfClass('RCTTextField') && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches((kindOfClass('RCTTextField') && kindOfClass('RCTScrollView'))))))",
  "Recovery Suggestion" : "Check if the element exists in the UI hierarchy printed below. If it exists, adjust the matcher so that it accurately matches element."
}

Error Trace: [
  {
    "Description" : "Failed to type string '
', because key [K] could not be found on the keyboard.",
    "Description Glossary" :     {
      "K" : "more, letters"
    },
    "Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
    "Error Code" : "0",
    "File Name" : "GREYKeyboard.m",
    "Function Name" : "+[GREYKeyboard grey_setErrorForkeyNotFoundWithAccessibilityLabel:forTypingString:error:]",
    "Line" : "494"
  }
]
      at Client._callee8$ (node_modules/detox/lib/client/Client.js:57:19)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
      at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:303:22)
      at Generator.prototype.(anonymous function) [as throw] (node_modules/regenerator-runtime/runtime.js:117:21)
      at step (node_modules/detox/lib/client/Client.js:1:809)
      at node_modules/detox/lib/client/Client.js:1:1008


questiostack overflow

All 6 comments

await element(by.label('Done')).tap();

Didn't worked, as I see there is three elements with the same label.
Do you have any idea how to catch by element by Traits?

Error: Error: Multiple UI elements matched for the given criteria.
Exception with Action: {
  "Action Name" : "Tap",
  "Element Matcher" : "(((((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('Done')) && !(descendantThatMatches((kindOfClass('RCTText') && ((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('Done')))))) && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches(((((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('Done')) && !(descendantThatMatches((kindOfClass('RCTText') && ((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('Done')))))) && kindOfClass('RCTScrollView'))))))",
  "Recovery Suggestion" : "Create a more specific matcher to uniquely match an element. If that's not possible then use atIndex: to select from one of the matched elements but the order of elements may change."
}

Error Trace: [
  {
    "Description" : "Multiple elements were matched: (
    "<_UIButtonBarButton:0x7fee994a9bd0; AX=Y; AX.label='Done'; AX.frame={{301, 407}, {74, 44}}; AX.activationPoint={338, 429}; AX.traits='UIAccessibilityTraitButton'; AX.focused='N'; frame={{301, 0}, {74, 44}}; opaque; alpha=1>",
    "<_UIModernBarButton:0x7fee994abdb0; AX=Y; AX.label='Done'; AX.frame={{317, 416}, {42, 23.5}}; AX.activationPoint={338, 427.75}; AX.traits='UIAccessibilityTraitButton,UIAccessibilityTraitNotEnabled'; AX.focused='N'; frame={{16, 9}, {42, 23.5}}; alpha=1; UIE=N>",
    "<UIButtonLabel:0x7fee994ac8e0; AX=Y; AX.label='Done'; AX.frame={{317, 419}, {42, 20.5}}; AX.activationPoint={338, 429.25}; AX.traits='UIAccessibilityTraitStaticText'; AX.focused='N'; frame={{0, 3}, {42, 20.5}}; alpha=1; UIE=N; text='Done'>"
). Please use selection matchers to narrow the selection down to single element.",
    "Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
    "Error Code" : "5",
    "File Name" : "GREYElementInteraction.m",
    "Function Name" : "-[GREYElementInteraction grey_errorForMultipleMatchingElements:withMatchedElementsIndexOutOfBounds:]",
    "Line" : "956"
  }
]
      at Client._callee8$ (node_modules/detox/lib/client/Client.js:57:19)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
      at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:303:22)
      at Generator.prototype.(anonymous function) [as throw] (node_modules/regenerator-runtime/runtime.js:117:21)
      at step (node_modules/detox/lib/client/Client.js:1:809)
      at node_modules/detox/lib/client/Client.js:1:1008

please post a screen shot of the keyboard and the app please

zrzut ekranu 2017-11-14 o 11 33 00

await waitFor(element(by.label('Done')).atIndex(0)).tap();

await waitFor(element(by.label('Done')).atIndex(0)).tap();

Didn't worked, but

await element(by.label('Done')).atIndex(0).tap();

Worked perfect thanks a lot. :) 馃憤

Was this page helpful?
0 / 5 - 0 ratings