This article briefly describes how to write automated scripts using Utraedit.
In any directory of the computer, create a new hello_appium.py file, appium-python-client-0.25.tar.gz and selenium-3.8.0.tar.gz extracted from the Appium folder and selenium The folder is placed in the same directory as the hello_appium.py sibling, and you can start writing code.
1 fromappium Import Webdriver2 Import Time3 4desired_caps={}5desired_caps['PlatformName']='Android'6desired_caps['platformversion']='4.4.2'7desired_caps['devicename']='7n2sse158p001892'8desired_caps['NoReset']='NoReset'9desired_caps['Apppackage']='Com.gomo.calculator'Tendesired_caps['appactivity']='. Ui.activity.MainActivity' OneDriver=webdriver. Remote ('Http://localhost:4723/wd/hub', desired_caps) #实例化driver ASelf.driver.implicitly_wait (Ten) #设置隐式等待时间 - -DRIVER.FIND_ELEMENT_BY_ID ("com.gomo.calculator:id/input_num_1"). Click () theDRIVER.FIND_ELEMENT_BY_ID ("com.gomo.calculator:id/input_num_5"). Click () -DRIVER.FIND_ELEMENT_BY_ID ("Com.gomo.calculator:id/display_op_add"). Click () -DRIVER.FIND_ELEMENT_BY_ID ("Com.gomo.calculator:id/input_num_6"). Click () -DRIVER.FIND_ELEMENT_BY_ID ("com.gomo.calculator:id/display_eq"). Click () +Driver.quit ()
How to run:
Open cmd, enter Python hello_appium.py (preferably full path), enter
This is the simplest application of appium.
First Appium Script