This article comes from the official official account of the project: “AirtestProject” copyright statement: reprint is allowed, but reprint must retain the original link; Do not use for commercial or illegal purposes

preface

In general, yosemite.apk is automatically installed on our Android devices (real or emulators) when we connect to them using Airtest. Yosemite is also enabled for input operations when the program executes to input statements.

But many of you who are new to Yosemite.apk are not familiar with yosemite.apk, and there is no detailed documentation on our website. So today we’re going to summarize some of the most common questions you’ve asked about Yosemite at 6 o ‘clock in order to give you a better idea of what Yosemite does and how it works.

1. Why can’t the keyboard of the mobile phone input method play when I type

Many students have just used Airtest to do the input operation, will find that the android device keyboard can not pop up, the effect is as follows:

Yosemite, Airtest’s input method for Android devices, doesn’t come with a keyboard, but a simple prompt at the bottom of the device. And whenever the text() interface is used in a script, it is called by default for input operations.

2. How do I quickly switch the input method of the device

When we connect our devices with Airtest, the current input method is typically set to Yosemite. But sometimes when we want to do manual input, we need to switch to a different input method.

① Switch quickly in the IDE

If you are using an IDE, you can open the Android Assistant in the upper right corner of the device window and quickly switch the input method in android Assistant before manually entering:

② Switch between phone Settings

If you are not using an IDE, you can also find the input method Settings in your phone Settings and switch the current input method to something other than Yosemite.

3. How to enter input using the text() interface

In a script, if you want to implement text input, you usually need this process:

Click on the position you want to enter to activate the input cursor

(2) Call Airtest’s text() interface to enter content

4.Yosemite is not installed or is not a problem with current input methods

① The device cannot be connected

By default, some brands block apps from being installed via USB, so Yosemite and other APKs won’t automatically be installed when the device is initialized, and Airtest won’t connect to the phone. In addition, the phone’s current input method is not Yosemite, which could affect device connections or script running.

(Airtest connecting to a simulator without Yosemite installed)

So when a connection fails/error occurs, we also need to check that Yosemite is installed on the device and set it to the current input method. In particular, many emulators do not automatically install Yosemite when they are initialized, so it is generally recommended to manually install Yosemite.apk before connecting to an Android emulator.

② Text () Interface input failed

If the text() interface fails, in one case the phone blocks Yosemite.apk from being installed and running, you can simply install it manually. Another common case is some type of mobile phone is not allowed to call the third party when the input password input method, then can check the phone Settings in the language and im – keyboard Settings, such as safety input, safety is not open, after cancel these options, you can use the system at the input method to input a password.

In addition, some special models are incompatible, failing Yosemite (OPPO and Vivo are more likely). If there is no need to input Chinese, try using the ADB shell Input command to do text input:

shell("input text 'hello world'")
Copy the code

At the same time, the above ADB shell input can be directly set to the default input, replacing the Yosemite input. For example, to initialize the phone in Python code, do this:

From airtest.core. API import * # Init_device ("Android", ime_method="ADBIME") text("hello")Copy the code

Some emulators (such as the Nighter emulator) may fail to enter successfully. Check to see if the hardware-physical keyboard is enabled in the Settings, try turning it off, set the default input method to Yosemite, and try again.

5. Where can I download Yosemite.apk

Download the latest IDE package from the official website, unpack it, and find yosemite.apk in the following path:

If you need to manually install pocoservice-debug.apk, you can also find it in the IDE decompressed file:

6.Yosemite screen recording

The 1.1.3 and 1.1.4 versions of Airtest also feature screen recording by Yosemite.apk. When many students use the screen recording function in the new test machine, they often report failure of screen recording and so on. This is because when you use the screen recording function for the first time, you need to manually open the Yosemite app on the device to allow Yosemite to capture the screen content of the device. If you do not allow screenshots in the following popup, the screen recording will fail:

So if you’re going to fail to record your screen, make sure you’ve already allowed intercepts on Yosemite. Other simulators (eg: Nighgod simulator) do not support this way of screen recording. Students can try to change other simulators.

To enable the screen recording function in a script, use the start_recording() interface and call stop_recording() to stop the screen recording.


Airtest website: airtest.netease.com/ Airtest tutorial website: airtest.doc.io.netease.com/ build enterprise private cloud service: airlab.163.com/b2b