io.selendroid.android
Class InstrumentedKeySender
java.lang.Object
io.selendroid.android.InstrumentedKeySender
- All Implemented Interfaces:
- KeySender
- Direct Known Subclasses:
- WebViewKeySender
public class InstrumentedKeySender
- extends Object
- implements KeySender
Provides a method to send a string to an application under test. Keys are sent using an
Instrumentation instance. The strings may contain any character in the
AndroidKeys enum.
Note that this class does not focus on a particular View before sending keys, nor does it
require that some View has focus. This is fine if you are sending the Menu key, or using
the arrow keys to select an item in a list. If you are trying to type into a certain widget, be
sure it has focus before using this class.
- Author:
- Matt DeVore
|
Constructor Summary |
InstrumentedKeySender(android.app.Instrumentation instrumentation)
Creates a new instance which sends keys to the given Instrumentation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instrumentation
protected final android.app.Instrumentation instrumentation
InstrumentedKeySender
public InstrumentedKeySender(android.app.Instrumentation instrumentation)
- Creates a new instance which sends keys to the given
Instrumentation.
getKeyboard
public Keyboard getKeyboard()
- Returns a
Keyboard object which sends key using this KeySender.
- Specified by:
getKeyboard in interface KeySender
- Returns:
- A
Keyboard object which sends key using this KeySender.
send
public void send(CharSequence text)
- Sends key events to the
Instrumentation. This method will send a portion of the given
CharSequence as a single String if the portion does not contain any special
keys.
- Specified by:
send in interface KeySender
- Parameters:
text - the keys to send to the Instrumentation.
Copyright © 2014. All rights reserved.