How can we use appium for keyboard testing

Does appium support keyboard testing? As uiautomatorviewer not shows the resource id or anything about the gboard.

it looks like you are with Android where keyboard hidden. But you ken user sendKey option to test.

// Java
((AndroidDriver) driver).pressKey(new KeyEvent(Key));

// where Key is
public enum AndroidKey {
    /**
     * Key code constant: Unknown key code.
     */
    UNKNOWN(0),
    /**
     * Key code constant: Soft Left key.
     * Usually situated below the display on phones and used as a multi-function
     * feature key for selecting a software defined function shown on the bottom left
     * of the display.
     */
    SOFT_LEFT(1),
    /**
     * Key code constant: Soft Right key.
     * Usually situated below the display on phones and used as a multi-function
     * feature key for selecting a software defined function shown on the bottom right
     * of the display.
     */
    SOFT_RIGHT(2),
    /**
     * Key code constant: Home key.
     * This key is handled by the framework and is never delivered to applications.
     */
    HOME(3),
    /**
     * Key code constant: Back key.
     */
    BACK(4),
    /**
     * Key code constant: Call key.
     */
    CALL(5),
    /**
     * Key code constant: End Call key.
     */
    ENDCALL(6),
    /**
     * Key code constant: '0' key.
     */
    DIGIT_0(7),
    /**
     * Key code constant: '1' key.
     */
    DIGIT_1(8),
    /**
     * Key code constant: '2' key.
     */
    DIGIT_2(9),
    /**
     * Key code constant: '3' key.
     */
    DIGIT_3(10),
    /**
     * Key code constant: '4' key.
     */
    DIGIT_4(11),
    /**
     * Key code constant: '5' key.
     */
    DIGIT_5(12),
    /**
     * Key code constant: '6' key.
     */
    DIGIT_6(13),
    /**
     * Key code constant: '7' key.
     */
    DIGIT_7(14),
    /**
     * Key code constant: '8' key.
     */
    DIGIT_8(15),
    /**
     * Key code constant: '9' key.
     */
    DIGIT_9(16),
    /**
     * Key code constant: '*' key.
     */
    STAR(17),
    /**
     * Key code constant: '#' key.
     */
    POUND(18),
    /**
     * Key code constant: Directional Pad Up key.
     * May also be synthesized from trackball motions.
     */
    DPAD_UP(19),
    /**
     * Key code constant: Directional Pad Down key.
     * May also be synthesized from trackball motions.
     */
    DPAD_DOWN(20),
    /**
     * Key code constant: Directional Pad Left key.
     * May also be synthesized from trackball motions.
     */
    DPAD_LEFT(21),
    /**
     * Key code constant: Directional Pad Right key.
     * May also be synthesized from trackball motions.
     */
    DPAD_RIGHT(22),
    /**
     * Key code constant: Directional Pad Center key.
     * May also be synthesized from trackball motions.
     */
    DPAD_CENTER(23),
    /**
     * Key code constant: Volume Up key.
     * Adjusts the speaker volume up.
     */
    VOLUME_UP(24),
    /**
     * Key code constant: Volume Down key.
     * Adjusts the speaker volume down.
     */
    VOLUME_DOWN(25),
    /**
     * Key code constant: Power key.
     */
    POWER(26),
    /**
     * Key code constant: Camera key.
     * Used to launch a camera application or take pictures.
     */
    CAMERA(27),
    /**
     * Key code constant: Clear key.
     */
    CLEAR(28),
    /**
     * Key code constant: 'A' key.
     */
    A(29),
    /**
     * Key code constant: 'B' key.
     */
    B(30),
    /**
     * Key code constant: 'C' key.
     */
    C(31),
    /**
     * Key code constant: 'D' key.
     */
    D(32),
    /**
     * Key code constant: 'E' key.
     */
    E(33),
    /**
     * Key code constant: 'F' key.
     */
    F(34),
    /**
     * Key code constant: 'G' key.
     */
    G(35),
    /**
     * Key code constant: 'H' key.
     */
    H(36),
    /**
     * Key code constant: 'I' key.
     */
    I(37),
.....
1 Like

I have to test the other elements of keyboard.
My main motive is to test the keyboard functionality only. Like open settings through keyboard ,open speech to text,etc.
Can I test only keyboard using appium?

Custom Android keyboard could be visible with Appium (try ask your developers), native Android keyboard suggest to use code above.

GBoard is not visible in Uiautomatorviewer. What’s the way to test Gboard using appium

just wonder why you need test GBoard? Or you need test GBoard with your app (= use code above)?

try to enable enableMultiWindows setting

If i want to check the change keyboard language functionality through keyboard not by going to settings then how it can be test with appium?

try first suggested MultiWindows key. there is chance that GBoard as it a bit custom could be visible.

PS if it fails i am out of ideas. visual compare hardly can suggest

PPS also try to look into adb commands. maybe they will help… e.g.

adb shell dumpsys window InputMethod 

I tried adb commands but it didn’t work for the keyboard

This help us in find element using xpath? I already tried element using Xpath