AppiumDesktop录制测试用例-创新互联
录制的脚本,可以拷贝到文件,用Pycharm打开
加了一个隐式等待
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()
只要启动Appium Server, 就可以运行成功了!
可以使用Appium Desktop运行server,
或者在命令行直接运行appium启动server
当前名称:AppiumDesktop录制测试用例-创新互联
文章源于:http://pwwzsj.com/article/cdoeio.html