Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Appium Desktop record test cases

Shulou Source: shulou.com Published: 2022-06-03 07:46:31 11月23日 Update

The recorded script can be copied to a file and opened with Pycharm

An implicit wait has been added

This sample code uses the Appium python clientpip install Appium-Python-ClientThen you can paste this into a file and simply run with Python

From appium import webdriver

Caps = {}

Caps ["platformName"] = "android"

Caps ["deviceName"] = "noblank"

Caps ["autoGrantPermissions"] = "true"

Caps ["appActivity"] = ".view.WelcomeActivityAlias"

Caps ["appPackage"] = "com.xueqiu.android"

Driver = webdriver.Remote ("http://localhost:4723/wd/hub", caps)

Driver.implicitly_wait (10)

El1 = driver.find_element_by_id ("com.xueqiu.android:id/tv_skip")

El1.click ()

El2 = driver.find_element_by_xpath ("/ hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout [1] / android.widget.LinearLayout/android.widget.TextView")

El2.click ()

El3 = driver.find_element_by_xpath ("/ hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout [1] / android.view.ViewGroup/android.widget.EditText")

El3.send_keys ("alibaba")

Driver.quit ()

As long as you start Appium Server, you can run successfully!

You can use Appium Desktop to run server

Or run appium directly from the command line to start server

Tags: Run succeed command copy file script test Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Huawei Microsoft Redmi Shulou Technology