# Dump and pull UI hierarchy adb shell uiautomator dump $dumpPath = $(adb shell uiautomator dump) -match '[^ ]+.xml' | % { $Matches[0] } adb pull $dumpPath view.xml # Parse XML $xml = [xml](Get-Content view.xml) # Recursive search for node with "AGREE" function Find-Node($node) { if ($node.text -like "*AGREE*") { $node } foreach ($child in $node.node) { Find-Node $child } } $node = Find-Node $xml.hierarchy $node = $node | Where-Object {$_.text -eq "More options"} $bounds = $node.bounds $bounds -match '\[(.*?)\]\[(.*?)\]' $p1 = $Matches[1] -split ',' $p2 = $Matches[2] -split ',' $xMid = ([int]$p1[0] + [int]$p2[0]) / 2 $yMid = ([int]$p1[1] + [int]$p2[1]) / 2 $coords = "$xMid $yMid" # Output coords $coords = "$xMid $yMid" Write-Host "Coords of 'AGREE AND CONTINUE': $coords" # Tap the element (uncomment to use) # adb shell input tap $coords