After the simulator and Appium Desktop start, click the magnifying glass to start the analyzer. In the JSON Representation in the lower right corner, click the pencil icon, input the following content, and save

{
    "platformName": "Android",
    "deviceName": "Nox",
    "appPackage": "com.xueqiu.android",
    "appActivity": ".view.WelcomeActivityAlias"
}
Copy the code

Click Start Session in the lower right corner to Start running

Click Start Recording to Start Recording

We click Agree and Tap the Tap option on the right, and the recording has started.

The program automatically generates code and can also modify the language. Here we’ll change to Python

If there is no synchronous display, click the semicircle icon to refresh the synchronous display operation

After recording their own operation, click the Recorder behind Show/Hide Boilerplate Code to generate sample Code

Click Copy Code to Clipboard to Copy

# This sample code uses the Appium python client # pip install Appium-Python-Client # Then you can paste this into a file and simply run with Python from appium import webdriver caps = {} caps["platformName"] = "Android" caps["deviceName"] = "Nox" caps["appPackage"] = "com.xueqiu.android" caps["appActivity"] = ".view.WelcomeActivityAlias" caps["ensureWebviewsHavePages"] = True driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) el1 = driver.find_element_by_id("com.xueqiu.android:id/tv_agree") el1.click() el2 = driver.find_element_by_id("com.xueqiu.android:id/ib_close") el2.click() el3 = driver.find_element_by_xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayo ut/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TabHost/android.widget.L inearLayout/android.widget.TabWidget/android.widget.RelativeLayout[2]/android.widget.ImageView") el3.click() driver.quit()Copy the code