mattinger
07/01/2022, 6:28 PMNode #5 at (l=0.0, t=0.0, r=320.0, b=174.0)px
[IsDialog]
|-Node #6 at (l=0.0, t=0.0, r=320.0, b=174.0)px, Tag: 'alertDialog'
|-Node #8 at (l=24.0, t=8.0, r=45.0, b=49.0)px
| Text = '[Let's try that again]'
| Actions = [GetTextLayoutResult]
|-Node #9 at (l=24.0, t=44.0, r=72.0, b=85.0)px
| Text = '[Sorry, we ran into a problem. Please try again.]'
| Actions = [GetTextLayoutResult]
|-Node #10 at (l=176.0, t=115.0, r=240.0, b=172.0)px
| Role = 'Button'
| Focused = 'false'
| Text = '[Exit setup]'
| Actions = [OnClick, GetTextLayoutResult]
| MergeDescendants = 'true'
|-Node #13 at (l=248.0, t=115.0, r=312.0, b=172.0)px
Role = 'Button'
Focused = 'false'
Text = '[Try again]'
Actions = [OnClick, GetTextLayoutResult]
MergeDescendants = 'true'
The problem is if i match using isDialog()
, there seems to be no decent way of checking all descendants, only direct children. So i had to add a test tag to the actual alert dialog, and then i can use onChildren()
to find one that has the right text. The other issue is that there’s no semantics indicating which one is the title and which one is the body. Same issue with buttons as well. I do suppose I could add test tags to each node individually in my call to AlertDialog. What are others doing here?