Skip to content
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

WebDriver: IllegalStateException: Could not retrieve hierarchy through maestro.getContentDescription() #1936

Closed
1 task done
pocmo opened this issue Aug 23, 2024 · 3 comments · Fixed by #1939
Closed
1 task done
Labels
waiting for customer response More information is needed from the customer before we can progress on the issue

Comments

@pocmo
Copy link
Contributor

pocmo commented Aug 23, 2024

Is there an existing issue for this?

  • I have searched the existing issues and didn't find mine.

Steps to reproduce

In our case the crash happens after pressing a login button after entering username/password. I'll debug the issue and either try to provide a patch or a public reproducible test case.

Actual results

We started to see a crash in WebDriver, but so far we haven't found the root cause yet.

java.lang.IllegalStateException: Could not retrieve hierarchy through maestro.getContentDescription()

Expected results

No crash

About app

(not public website)

About environment

  • macOS 14.5
  • Chrome Version 128.0.6613.85 (Official Build) (x86_64)

Logs

Logs
java.lang.IllegalStateException: Could not retrieve hierarchy through maestro.getContentDescription()
        at maestro.drivers.WebDriver.contentDescriptor(WebDriver.kt:175)
        at maestro.ViewHierarchy$Companion.from-8JJjmZI(ViewHierarchy.kt:29)
        at maestro.utils.ScreenshotUtils$Companion.viewHierarchy-c1iYVAs(ScreenshotUtils.kt:99)
        at maestro.utils.ScreenshotUtils$Companion.waitForAppToSettle-OpTFbEc(ScreenshotUtils.kt:58)
        at maestro.utils.ScreenshotUtils$Companion.waitForAppToSettle-OpTFbEc$default(ScreenshotUtils.kt:38)
        at maestro.drivers.WebDriver.waitForAppToSettle-5RpGHs4(WebDriver.kt:366)
        at maestro.Maestro.waitForAppToSettle-5RpGHs4(Maestro.kt:474)
        at maestro.Maestro.waitForAppToSettle-5RpGHs4$default(Maestro.kt:469)
        at maestro.Maestro.hierarchyBasedTap-hbl3e4M(Maestro.kt:353)
        at maestro.Maestro.performTap-hbl3e4M(Maestro.kt:281)
        at maestro.Maestro.tap-BUbHBYE(Maestro.kt:195)
        at maestro.orchestra.Orchestra.tapOnElement(Orchestra.kt:777)
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:240)
        at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:605)
        at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:646)
        at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:514)
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:270)
        at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:605)
        at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:646)
        at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:514)
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:270)
        at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:605)
        at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:646)
        at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:514)
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:270)
        at maestro.orchestra.Orchestra.executeSubflowCommands(Orchestra.kt:605)
        at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:646)
        at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:514)
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:270)
        at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:201)
        at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:111)
        at maestro.orchestra.Orchestra.runFlow$default(Orchestra.kt:75)
        at maestro.cli.runner.MaestroCommandRunner.runCommands(MaestroCommandRunner.kt:185)
        at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:54)
        at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:51)
        at maestro.cli.runner.TestRunner.runCatching(TestRunner.kt:145)
        at maestro.cli.runner.TestRunner.runSingle(TestRunner.kt:51)
        at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1$1.invoke(TestCommand.kt:291)
        at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1$1.invoke(TestCommand.kt:249)
        at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:107)
        at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
        at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:249)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)```

</details>


### Maestro version

1.37.9

### How did you install Maestro?

install script (https://get.maestro.mobile.dev)

### Anything else?

_No response_
@pocmo
Copy link
Contributor Author

pocmo commented Aug 23, 2024

In this specific situation executeJS() returns null. There's already a sleep(100). In this case it seems like more time is needed. If I add a retry loop then this will work after ~500ms.

private fun executeJS(js: String): Any? {
val executor = seleniumDriver as JavascriptExecutor
try {
executor.executeScript("$maestroWebScript")
Thread.sleep(100)
return executor.executeScript(js)
} catch (e: Exception) {
if (e.message?.contains("getContentDescription") == true) {
return executeJS(js)
}
return null
}
}

@bartekpacia
Copy link
Contributor

Hey, thanks for the report. Waiting for reproducible example.

@bartekpacia bartekpacia added the waiting for customer response More information is needed from the customer before we can progress on the issue label Aug 23, 2024
Copy link

github-actions bot commented Sep 9, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.
Thank you for helping keep us our issue tracker clean!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
waiting for customer response More information is needed from the customer before we can progress on the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants