https://github.com/appium/appium/blob/master/docs/en/migrating-to-1-0.md

总结下

  1. 使用了 appium 自己的客户端库替换传统的 webdriver 客户端库
  2. capabilities 的命名发生了改变
  3. 定位策略也进行了调整, 需要使用控件的全类名, 而不再是影射的 tag 名字了. 定位策略也去掉了 name 定位
  4. windows_handles 修改为 context 方法
  5. execute_script mobile 方法被移除, 目前支持正规的 api 了
  6. 增加了一个新的手势 api

Migrating your tests from Appium 0.18.x to Appium 1.x

Appium 1.0 has removed a number of deprecated features from the previous versions. This guide will help you know what needs to change in your test suite to take advantage of Appium 1.0.

New client libraries

The biggest thing you need to worry about is using the new Appium client libraries instead of the vanilla WebDriver clients you are currently using. Visit the Appium client list to find the client for your language. Downloads and instructions for integrating into your code are available on the individual client websites.

Ultimately, you'll be doing something like (to use Python as an example):

from appium import webdriver

Instead of:

from selenium import webdriver

New desired capabilities

The following capabilities are no longer used:

Instead, use these capabilities:

The app capability remains the same, but now refers exclusively to non-browser apps. To use browsers like Safari or Chrome, use the standard browserName cap. This means that app and browserName are exclusive.

We have also standardized on camelCase for Appium server caps. That means caps like app-package or app-wait-activity are now appPackage and appWaitActivity respectively. Of course, since Android app package and activity are now auto-detected, you should be able to omit them entirely in most cases.

New locator strategies

We've removed the following locator strategies:

We have now added the accessibility_id strategy to do what name used to do. The specifics will be relative to your Appium client.

tag name has been replaced by class name. So to find an element by its UI type, use the class name locator strategy for your client.

Note about class name and xpath strategies: these now require the fully-qualified class name for your element. This means that if you had an xpath selector that looked like this:

//table/cell/button

It would now need to be:

//UIATableView/UIATableCell/UIAButton

(And likewise for Android: button now needs to be android.widget.Button)

We've also added the following locator strategies:

Refer to your client for ways to use these new locator strategies.

XML, not JSON

App source methods, which previously returned JSON, now return XML, so if you have code that relies on parsing the app source, it will need to be updated.

Hybrid support through context, not window

Hybrid apps were previously supported by switching between "windows" using

Now Appium supports the more conceptually consistent concept of "context". To get all of the available contexts, or the particular context the application is is, you use

driver.contexts
current = driver.context

And to switch between them, you use

driver.switch_to.context("WEBVIEW")

No more execute_script("mobile: xxx")

All the mobile: methods have been removed, and have been replaced by native methods in the Appium client libraries. This means that a method call like driver.execute("mobile: lock", [5]) will now look something more like driver.lock(5) (where lock has been turned into a native client method). Of course, the details on calling these methods will differ by client.

Of particular note, the gesture methods have been replaced by the new TouchAction / MultiAction API which allows for a much more powerful and general way of putting gestural automation together. Refer to your Appium client for usage notes on TouchAction / MultiAction.

And that's it! Happy migrating!


↙↙↙阅读原文可查看相关链接,并与作者交流