google/EarlGrey

The class obtained from the class name cannot be nil

blackcat-vin opened this issue · 4 comments

Hi

My setup is as follows:
Xcode 12.3
iOS 14.3 iPhone 11 Pro Simulator
I have the latest Project based setup of EarlGrey2 with latest submodules:

let matchers: [GREYMatcher] = [grey_accessibilityID(textField.inputId),
grey_not(grey_kindOfClassName("UIAccessibilityTextFieldElement"))]

For the above grey_kindOfClassName line returning The class obtained from the class name cannot be nil (NSInternalInconsistencyException) error message ? Anything changed or am i passing something incorrectly ?

id grey_kindOfClassName(NSString *className) {
return [GREYMatchers matcherForKindOfClassName:className];
}

  • (id)matcherForKindOfClassName:(NSString *)className {
    GREYThrowOnFailedConditionWithMessage(NSClassFromString(className),
    @"The class obtained from the class name cannot be nil");
    return [self matcherForKindOfClass:NSClassFromString(className)];
    }

Is this just an array of matchers or part of an allOf or anyOf statement?

Is this just an array of matchers or part of an allOf or anyOf statement?

correct this is the method i am calling ? the bold one gives me the error

@discardableResult
func select(_ textField: TextField,
position: Int? = nil,
file: StaticString = #file,
line: UInt = #line) -> Self {
let matchers: [GREYMatcher] = [grey_accessibilityID(textField.inputId),
grey_not(grey_kindOfClassName("UIAccessibilityTextFieldElement"))]

    let element = EarlGrey.selectElement(with: grey_allOf(matchers),
                                         file: file, line: line)
    
    element.perform(grey_tap())
    
    if let position = position {
        element.perform(host.grey_textFieldPosition(position))
    }
    
    return self
}

@AlbertWang0116 Can you look into this? I think there's a problem in OSS with Swift and grey_allOf/grey_anyOf.

This issue was fixed in eDO 1.0.2 and pinned by the latest EarlGrey 2.2.1 release.

Do you still see this issue by syncing your EarlGrey?