简而言之:我们准备淘汰 Selenium 自己的 AndroidDriver 和 iPhoneDriver,改用 Selendroid,iosdriver 和 Appium 中的任意一个。如果你正在使用 Selenium 的 mobile driver 中的一个的话,请评估并考虑这些替代品。
正文:
在 2007 年, 乔布斯发布了 iPhone,从此移动 web 从本来的新奇事物走上了主流,成为大众的宠儿。如今的趋势预示着在不远的将来,移动 web 的使用将超过桌面应用的使用。移动 Web 将成为你站点重要一部分,而且在移动设备上测试你的网站将是一个明智的想法。而这在未来将会持续一段时间。
Selenium 项目通过实现 iOS 和 Android 版本的 webdriver 来回应崛起的移动 web。在 2009 年初期,我们加入了 iPhoneDriver (在 iPad 上也能工作)。2010 年 6 月,最初由 Google 工程师开发的 AndroidDriver 也加入了阵营。 直到今天,你能在官方 Android SDK 的下载选项中发现 “Google WebDriver” 的身影。
在最初的工作完成之后,一些有趣的事情发生了。在 Selenium 项目之外,坊间对这些移动 driver 做了很多实验性的扩展和修改。第一个就是 “nativedriver”,我也参与于此。它采用了一个新奇的方式,使用熟悉的 WebDriver 接口,允许用户和手机 (Android 或者 iOS) 原生的 UI 交互。我第一次见到它时,惊呆了。但是开发它的工程师很快就向我证明了这是有意义的。你猜怎样,他们是对的。
可惜的是,在证明这个主意是可行且能工作后,NativeDriver 项目突然失去了动力。但是,它给其他三个项目做好了准备,这三个项目采用了它的理念,创造了非常棒的移动测试软件,他们就是: Selendroid, iosdriver 和 Appium。这三个项目都允许用户用熟知的 WebDriver 接口来测试 iOS 和 Android 上的应用。不仅仅是原生的应用,也包括混合或者纯 web 的应用。最近 Windows Phone WebDriver 也加入了他们,我们可以用来测试 WinPhone 8 上的移动 web 应用。
这些项目都有一个共同点:他们比 Selenium 移动主项目更加地活跃,更能胜任移动测试工作,也已经走的更远。事实上,原先在 AndroidDriver 和 iPhoneDriver 上的贡献者也开始在这些项目上工作了。我们需要维护不同 driver 间的互通性,允许用户选择最适合他们的框架,而不必担心他们的测试会需要大量重构。
这就意味着在 selenium 项目中继续保留 AndroidDriver 和 iPhoneDriver 已经不能帮助用户了。那些替代者才是更好的选择。保留这些所谓官方的 driver 只会污染了项目。而且更糟糕的是,selenium 的开发修复这些 driver 上的 bug 非常慢,而这些 bug 让每个参与与此的人都非常沮丧。鉴于此,Selenium 项目决定删除这些 driver 的代码。我们推荐大家评估那些备选的其中之一使用。
当然,这些代码会仍然保留在我们的代码历史中,所以如果你想自己构建一个的话,还是有可能的。最新的 iPhoneDriver 是 ef9d578,最新的 AndroidDriver 代码是 00a3c7d。我们已经上传了最新版本的 AndroidDriver 供你下载。
这些改变并不意味着我们不再支持移动测试。它意味着我们只支持最好的 mobile WebDriver 实现,只是他们不是 Selenium 项目的一部分而已。
原文:
TL;DR: We’re retiring Selenium’s own AndroidDriver and iPhoneDriver in favour of any of Selendroid, iosdriver and Appium. If you’re using one of Selenium’s own mobile drivers, please evaluate one of these alternatives.
The longer version:
In 2007, Steve Jobs announced the iPhone and changed the mobile Web from a curiosity to something the mainstream wanted and used. Current trends suggest that mobile Web usage will surpass desktop usage in the not too distant future. Which is a long way of saying the mobile Web is going to be a big part of the future of your sites and that it’d be an extremely wise idea to test them on mobile devices.
The Selenium project responded to the rise of the mobile web by working to produce WebDriver implementations for both iOS and Android. The first lines of the iPhoneDriver (which also worked on the iPad) were added to the project early in 2009. The AndroidDriver was added in June 2010, and was primarily developed by engineers at Google. To this day you can download the official Android SDK and find “Google WebDriver” as one of the optional extras you can download.
After the initial work on the mobile drivers, something interesting happened. Experimental extensions and modifications to the drivers were made outside of the selenium project. The first one of these that I was involved with was “nativedriver“. This took the novel approach of allowing users to interact with the native UI of the phone, be it Android or iOS, using the familiar WebDriver APIs. The first time I saw it, I thought it was madness, but the engineers working on it soon convinced me that it made sense. And guess what? They were right.
Sadly, after proving the idea was viable and workable, the NativeDriver project ran out of steam, but it set the scene for three projects that have taken the idea and run with it to create remarkably capable pieces of mobile testing software: Selendroid, iosdriver and Appium. All three of these allow a tester familiar with the WebDriver APIs to test mobile apps on iOS and Android. Not only native ones, but also hybrid or pure web-based ones too. They’ve recently been joined by the Windows Phone WebDriver, which allows testing of mobile web apps on WinPhone 8.
All of these projects have something in common: they’re far more active, more capable and have pushed further than the equivalent code in the main selenium project. In fact, some of the members of the selenium team that contributed to both AndroidDriver and iPhoneDriver are now also working on those other projects. There’s work being done to maintain interoperability between the different drivers, allowing users to chose which framework is most appropriate for their needs without fear of their tests needing major rework.
This means that keeping the existing Android and iPhone drivers within the Selenium project isn’t helping our users. The alternatives are better, and keeping “official” drivers within the project muddies the water. Worse, the selenium developers are slow at making fixes to those drivers, which is incredibly frustrating for everyone involved. Because of this, the Selenium project has deleted the code for those drivers from its repository and we recommend you evaluate and use one of the alternatives.
Of course, the code will still live in our repo’s history, so if you’d like to build them yourself, then it’s still possible. The last version with the iPhoneDriver is ef9d578, and the last one with the Android source is 00a3c7d. We’ve uploaded a version of the AndroidDriver built from that revision to the downloads page to save you having to do so yourself.
These changes do not mean that we don’t support mobile as a project. It just means that we support the best implementations of mobile WebDriver, and those aren’t written as part of the Selenium project.