-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find element using await driver.$(~${tag}
) in Appium 2.0.0 for React Native app (can be replicated on iOS device&simulator, Android is fine)
#18920
Comments
as same as Appium 1, the below syntax works as part of capabilities.
The client method could vary, but https://appium.io/docs/en/2.0/guides/settings/ also works. |
Thanks for your info. And there seems no errors in the Appium log: However, from Appium Inspector, I stil get the same App source (Signup-EmailInput is not in its independent node) Not sure if snapshotMaxDepth and customSnapshotTimeout are readlly taking effects. |
If your question was how to split the big one e.g.
|
Thanks. I have tried both 50 and 62 (max supported) for 'snapshotMaxDepth' settings, and the App source stayed the same as when it is set to 500 or not set. (Signup-EmailInput is not in its independent node) However, when I set 'snapshotMaxDepth' to be 10, I did get less depth of the App source, so 'snapshotMaxDepth' setting did take effects somehow. Just wondering why Appium is not trying to get elements in more depth, even when 'snapshotMaxDepth' is specified to be 50, 62 and 500 in my case. (especially my app has a very simple UI, as the screenshot I shared in the first message) Also, I commented out the outer the accessible, accessibilityLabel and testId properties in the outer elements, but not luck either. Is there any other workarounds? Or otherwise, iOS auto testing using Appium is not usable. |
WDA gives it as a parameter of https://github.com/appium/WebDriverAgent/blob/c204c73081ed210399427917ab43056c07f6f491/PrivateHeaders/XCTest/XCAXClient_iOS.h#L51 (by XCTest), so it might indicate XCTest framework returns only these. What the result of https://appium.github.io/appium-xcuitest-driver/4.32/execute-methods/#mobile-source with |
Executed this in SignUp screen: With 'appium:settings[snapshotMaxDepth]': 50 Here is the execution result: |
So, the result was the same, correct? It is vanilla debugDescription by XCTest framework. Some comments in #14825 may help to improve the structure of RN application side so that XCTest framework can treat them further, but am afraid no much can do as Appium/WDA side. Closing this ticket as not much can do as Appium/WDA. Moving to the #14825 https://discuss.appium.io/ may also help to find something past record about RN. |
The goal is to get the element of this:
<TextInput
// accessible={true}
testID={TestIDs.Components.Signup.EmailInput}
accessibilityLabel={TestIDs.Components.Signup.EmailInput}
ref={(rf) => { this.emailTextInput = rf }}
placeholder={translate("EmailPlaceHolder")}
value={this.state.email}
onChangeText={(text) => this.setState({
validationAlert: false,
email: text
})}
//placeholderTextColor={'black'}
placeholderTextColor={'#acacac'}
style={{
color: APP_BLACK_TEXT_COLOR, fontSize: 16,
marginTop: 2, fontWeight: '400',
padding: 5,
flex: 1,
marginLeft: 10
}}
/>
and the EmailInput value is defined here:
Signup: {
EmailInput: 'Signup-EmailInput',
ConfirmEmailInput: 'Signup-ConfirmEmailInput',
FullNameInput: 'Signup-FullNameInput',
ErrorMessage: 'Signup-ErrorMessage',
ContinueButton: 'Signup-ContinueButton',
CloseButton: 'Signup-CloseButton',
LoginButton: 'Signup-LoginButton',
},
This is the App Source extracted from Appium Inspector:
This is the UI preview in the inspector (as you can see, I selected the most nested node, but I cannot expend it further):
In Appium 1.0, there seems a way to set snapshotMaxDepth and customSnapshotTimeout, I tried:
capabilities: {
platformName: 'iOS',
'appium:automationName': 'XCUITest',
'appium:deviceName': 'iPhone 13',
'appium:app': '/Users/dongchenzhang/Library/Developer/Xcode/DerivedData/PackageTrackingApp-gfzkdaytisfbfwbrdbqztcicjmbo/Build/Products/Debug-iphonesimulator/TrackMyPack.app',
'appium:fullReset': false, // by default is true
'appium:noReset': true,
// 'appium:settings[snapshotMaxDepth]': 100,
'appium:snapshotMaxDepth': 500,
'appium:customSnapshotTimeout': 60000,
},
but Appium does not recognize:
[Appium] Available drivers:
[Appium] - [email protected] (automationName 'Espresso')
[Appium] - [email protected] (automationName 'UiAutomator2')
[Appium] - [email protected] (automationName 'XCUITest')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
[HTTP] --> POST /wd/hub/session
[HTTP] {"capabilities":{"alwaysMatch":{"platformName":"iOS","appium:automationName":"XCUITest","appium:deviceName":"iPhone 13","appium:app":"/Users/dongchenzhang/Library/Developer/Xcode/DerivedData/PackageTrackingApp-gfzkdaytisfbfwbrdbqztcicjmbo/Build/Products/Debug-iphonesimulator/TrackMyPack.app","appium:fullReset":false,"appium:noReset":true,"appium:snapshotMaxDepth":500,"appium:customSnapshotTimeout":60000},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"iOS","appium:automationName":"XCUITest","appium:deviceName":"iPhone 13","appium:app":"/Users/dongchenzhang/Library/Developer/Xcode/DerivedData/PackageTrackingApp-gfzkdaytisfbfwbrdbqztcicjmbo/Build/Products/Debug-iphonesimulator/TrackMyPack.app","appium:fullReset":false,"appium:noReset":true,"appium:snapshotMaxDepth":500,"appium:customSnapshotTimeout":60000}}
[debug] [AppiumDriver@e068] Calling AppiumDriver.createSession() with args: [{"platformName":"iOS","appium:automationName":"XCUITest","appium:deviceName":"iPhone 13","appium:app":"/Users/dongchenzhang/Library/Developer/Xcode/DerivedData/PackageTrackingApp-gfzkdaytisfbfwbrdbqztcicjmbo/Build/Products/Debug-iphonesimulator/TrackMyPack.app","appium:fullReset":false,"appium:noReset":true,"appium:snapshotMaxDepth":500,"appium:customSnapshotTimeout":60000},null,{"alwaysMatch":{"platformName":"iOS","appium:automationName":"XCUITest","appium:deviceName":"iPhone 13","appium:app":"/Users/dongchenzhang/Library/Developer/Xcode/DerivedData/PackageTrackingApp-gfzkdaytisfbfwbrdbqztcicjmbo/Build/Products/Debug-iphonesimulator/TrackMyPack.app","appium:fullReset":false,"appium:noReset":true,"appium:snapshotMaxDepth":500,"appium:customSnapshotTimeout":60000},"firstMatch":[{}]}]
[debug] [AppiumDriver@e068] Event 'newSessionRequested' logged at 1690507966239 (18:32:46 GMT-0700 (Pacific Daylight Saving Time))
[Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'iOS'
[Appium] The 'xcuitest' driver was installed and matched caps.
[Appium] Will require it at /Users/dongchenzhang/Desktop/work/Linquet/repository/track-my-pack-fork2_appiumQA/node_modules/appium-xcuitest-driver
[debug] [Appium] Requiring driver at /Users/dongchenzhang/Desktop/work/Linquet/repository/track-my-pack-fork2_appiumQA/node_modules/appium-xcuitest-driver
[AppiumDriver@e068] Appium v2.0.0 creating new XCUITestDriver (v4.32.20) session
[AppiumDriver@e068] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@e068] Appium's BaseDriver version is 9.3.15
[AppiumDriver@e068] XCUITestDriver's BaseDriver version is 9.3.15
[debug] [XCUITestDriver@0db7] Creating session with W3C capabilities: {
[debug] [XCUITestDriver@0db7] "alwaysMatch": {
[debug] [XCUITestDriver@0db7] "platformName": "iOS",
[debug] [XCUITestDriver@0db7] "appium:automationName": "XCUITest",
[debug] [XCUITestDriver@0db7] "appium:deviceName": "iPhone 13",
[debug] [XCUITestDriver@0db7] "appium:app": "/Users/dongchenzhang/Library/Developer/Xcode/DerivedData/PackageTrackingApp-gfzkdaytisfbfwbrdbqztcicjmbo/Build/Products/Debug-iphonesimulator/TrackMyPack.app",
[debug] [XCUITestDriver@0db7] "appium:fullReset": false,
[debug] [XCUITestDriver@0db7] "appium:noReset": true,
[debug] [XCUITestDriver@0db7] "appium:snapshotMaxDepth": 500,
[debug] [XCUITestDriver@0db7] "appium:customSnapshotTimeout": 60000
[debug] [XCUITestDriver@0db7] },
[debug] [XCUITestDriver@0db7] "firstMatch": [
[debug] [XCUITestDriver@0db7] {}
[debug] [XCUITestDriver@0db7] ]
[debug] [XCUITestDriver@0db7] }
[XCUITestDriver@0db7] The following capabilities were provided, but are not recognized by Appium:
[XCUITestDriver@0db7] snapshotMaxDepth
[XCUITestDriver@0db7] customSnapshotTimeout
How can I set snapshotMaxDepth and customSnapshotTimeout correctly in Appium 2.0.0?
Or is there any other solution from another perspective? Thanks.
The text was updated successfully, but these errors were encountered: