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 8038819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:21:45+00:00 2026-06-05T03:21:45+00:00

I use UIAutomation to test my iPhone app. My app has a UISearchBar ,

  • 0

I use UIAutomation to test my iPhone app.
My app has a UISearchBar, after I made it focused,
this line of script shows that the app now has 2 UIAWindow.

UIATarget.localTarget().frontMostApp().logElementTree();

The second UIAWindow has UIAKeyboard as a child.

enter image description here

Do you know how to get a reference of the second UIAWindow, so I could get a reference to the UIAKeyboard?

I’ve tried

UIATarget.localTarget().frontMostApp().mainwindow()[1].keyboard().key()["Q"].tap();

but it doesn’t work.

EDIT 1:
I use this line to get reference of the Keyboard. It works.

UIATarget.localTarget().frontMostApp().windows()[1].logElementTree();

but when I tried to type something with the keyboard:

UIATarget.localTarget().frontMostApp().keyboard().typeString("Hello world");

or

UIATarget.localTarget().frontMostApp().keyboard().keys()["A"].tap; 

but they don’t work.

Do you know how to type some thing with the keyboard?


EDIT:
(just to let you guys know how to make the UIAKeyboard works for you)


UIATarget.localTarget().frontMostApp().keyboard().keys()[“A”].tap;
doesn’t work
UIATarget.localTarget().frontMostApp().keyboard().keys()[“A”].tap();
works

and
UIATarget.localTarget().frontMostApp().keyboard().typeString(“This is a message”);
works

  • 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-06-05T03:21:47+00:00Added an answer on June 5, 2026 at 3:21 am

    The last two code snippets that you have posted should work, but they only work if your keyboard is open(visible on screen). An alternate way of doing this is to access the textfield(where you want to type whatever you are trying to type) and then call the function .setValue("Hello world") or .typeString("Hello world"). These two are functions of the textField object. Hope this helps.

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

Sidebar

Related Questions

I want to be able to use UIAutomation to test an app. The problem
use this code, in the Preferences activity, to know when the reset preference has
I am trying to use UIAutomation in Instruments with the iPhone Simulator and the
Use case is this: I want to unit test (in browser, QUnit or something
I use the iOS UI Automation framework to make sure my iPhone app rocks.
Use case: I find a piece of code that I do not understand at
use this website a lot but first time posting. My program creates a number
Use case: User launches app The user enters google password The app lets the
I'm working for an iPhone project. I would like to use an UI Automation
use warnings; use Test::More; use File::Find::Rule; use Test::File::Find::Rule; my $rule = File::Find::Rule->file->name('*.pl')->not_grep(qr/^\s*use\s+strict;/m, sub {

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.