錄製的腳本,能夠拷貝到文件,用Pycharm打開
加了一個隱式等待python
from appium import webdriverandroid
caps = {}
caps["platformName"] = "android"
caps["deviceName"] = "noblank"
caps["autoGrantPermissions"] = "true"
caps["appActivity"] = ".view.WelcomeActivityAlias"
caps["appPackage"] = "com.xueqiu.android"web
driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
driver.implicitly_wait(10)app
el1 = driver.find_element_by_id("com.xueqiu.android:id/tv_skip")
el1.click()ide
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()ui
只要啓動Appium Server, 就能夠運行成功了!this
可使用Appium Desktop運行server,
或者在命令行直接運行appium啓動server命令行