Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3974304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:33:08+00:00 2026-05-20T04:33:08+00:00

I am trying to use UIAutomation in Instruments with the iPhone Simulator and the

  • 0

I am trying to use UIAutomation in Instruments with the iPhone Simulator and the latest iOS SDK 4.1. Here is the snippet of javascript that is having a problem:

// there are sufficient delays here to make sure the view is loaded
UIATarget.localTarget().frontMostApp().logElementTree();
main.buttons()["theButton"].tap();
UIALogger.logMessage("The button tapped");
for (var b = 0; b < main.buttons().length; b++)
{
    UIALogger.logMessage("Button title: " + main.buttons()[b].name());
}
main.toolbar().buttons()["OK"].tap();
UIALogger.logMessage("OK tapped");

The button name of “theButton” shows up in the logElementTree as well as showing up when I am logging the names of all the buttons, so it is correctly configured in the Interface Builder, but for some reason, it does not get tapped. I have other buttons earlier in the script that are getting tapped just fine, and if I abort the script at the point of the non-tapped button, I can click on the button in the Simulator and it works as expected.

EDIT: In the javascript for loop shown above, I had it tap each of the buttons in the main.buttons() array, and only 1 of the 12 identical buttons on the view gets the tap.

Also, in case you were wondering, I have this code at the top of the javascript file:

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var main = app.mainWindow();

And here is the line that shows the button information from the sequence of entries that logElementTree puts into the log messages:

4) UIAButton [name:theButton value:(null) NSRect: {{25, 93}, {74, 74}}]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:33:09+00:00Added an answer on May 20, 2026 at 4:33 am

    I had similar problem with tapping a button on an actionSheet. I’m performing the scripts on the actual device.
    My code is:

    //check that action sheet is on the screen
        app.actionSheetIsValid();
    
    //check that the button is on the actionSheet
        actionSheet.actionSheetButton("Exit");
    
    //touch Exit button
        actionSheet.tapActionSheetButtonByName("Exit");
    

    All functions perform and pass, however the button is not pressed.
    logElementTree(); shows that the button is there.

    I tried to add target.pushTimeout(5); after I check that the button is on the actionSheet in order to give it some time to detect and tap the button. This didn’t help.

    Then I added: target.delay(1); right after I check that the button is on the actionSheet and before tapping it.
    It helped in my case, the script is more robust and stable now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am need paint my image. I'm trying use JQuery in here this link:
I am trying use javascript regular expressions to do some matching and I found
I'm a little confused here, I am trying use a partial view in a
I am trying use a javascript function while passing php variables in it. For
I am trying use a javascript function while passing php variables in it. For
I'm trying use eco for client-side templating. I have multiple .eco templates that I'd
I have a regex that I'm trying use to validate against strings. Trying to
I have a 3rd party DLL that I am trying to use in a
I'm trying use an object which wasn't available until SDK level 5. It seems
I am trying use Thread but i have some problem (I am beginner at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.