0

I tried the tapAndHold() function from UIAElement

var target = UIATarget.localTarget();
target.frontMostApp().mainWindow().buttons()["Button"].tapAndHold()
target.captureScreenWithName("shot")

but this fails with a JavaScript error: 'undefined' is not a function (evaluating target.frontMostApp().mainWindow().buttons()["Button"].tapAndHold().

Update:

I also tried

target.frontMostApp().mainWindow().buttons()["Button"].touchAndHold(1.5)
target.captureScreenWithName("shot")

which at least does highlight the button but when the screenshot is made it already is deactivated again. :(

Ortwin Gentz
  • 52,648
  • 24
  • 135
  • 213

1 Answers1

0

Insert delay(1).

target.frontMostApp().mainWindow().buttons()["Button"].touchAndHold(1.5)
target.delay(1);
target.captureScreenWithName("shot")

Are you running it on iPod? Also it matters on which device you are testing. I suggest using iPhone 3GS,4S to check more variety.

ExploringApple
  • 1,348
  • 2
  • 17
  • 30