ui-auto-monkey icon indicating copy to clipboard operation
ui-auto-monkey copied to clipboard

Function: lockForDuration() is failed to unlock the simulator

Open JohnnyWuMigme opened this issue 10 years ago • 3 comments

Hi Jonathan, please allow me to call you teacher. Thanks for your great book and tool, I really studied a lot from them.

I encounter a problem in using the Monkey tool. When I call lockForDuration() in my script, most of time it's unable to unlock the simulator (sometimes it could, I don't know why), the log shows:

2015-02-16 14:02:06 +0000 Debug: target.lockForDuration("0.01863725995644927") 2015-02-16 14:02:07 +0000 Debug: target.systemApp().mainWindow().scrollViews().firstWithPredicate("ANY elements.name == 'SlideToUnlock' OR ANY elements.name == 'SlideToSetup' OR ANY elements.name == 'Passcode field'").dragInsideWithOptions({endOffset:{x:0.90,y:0.90}}, duration:"0.5", startOffset:{x:0.20,y:0.90}}}) 2015-02-16 14:02:09 +0000 Debug: Unlock failed. Retrying up to 2 more time(s). 2015-02-16 14:02:09 +0000 Debug: target.systemApp().mainWindow().scrollViews().firstWithPredicate("ANY elements.name == 'SlideToUnlock' OR ANY elements.name == 'SlideToSetup' OR ANY elements.name == 'Passcode field'").dragInsideWithOptions({endOffset:{x:0.90,y:0.90}}, duration:"0.5", startOffset:{x:0.20,y:0.90}}}) 2015-02-16 14:02:10 +0000 Debug: Unlock failed. Retrying up to 1 more time(s). 2015-02-16 14:02:10 +0000 Debug: target.systemApp().mainWindow().scrollViews().firstWithPredicate("ANY elements.name == 'SlideToUnlock' OR ANY elements.name == 'SlideToSetup' OR ANY elements.name == 'Passcode field'").dragInsideWithOptions({endOffset:{x:0.90,y:0.90}}, duration:"0.5", startOffset:{x:0.20,y:0.90}}})

I use Xcode 6.1, simulator is iPhone 6. I want to trace the lockForDuration() but I don't know where the code is in my OSX. Do you have any idea or hint that I can move on? Thanks teacher!

JohnnyWuMigme avatar Feb 17 '15 04:02 JohnnyWuMigme

I have the same problem. UIATarget.lockForDuration()successfully locks the device, but fails to unlock it afterwards. It seems as if the sliding gesture to unlock the device is not sufficient.

skrach avatar Feb 17 '15 14:02 skrach

Alas, if the function isn't working, then it is the fault of the Automation instrument and the script can address the problem. File a bug with Apple and post the bug number here for reference for anyone to dupe.

jonathanpenn avatar Feb 18 '15 02:02 jonathanpenn

Bug number: 19933099 https://bugreport.apple.com/problem/viewproblem

Thanks all!

JohnnyWuMigme avatar Feb 24 '15 03:02 JohnnyWuMigme