I have exactly the same problem. I tried your code but it stops at the first line until I manually tap the code otherwise the test fails after a timeout.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags: