Selenium RC 和 WebDriver 之间的关系是什么? [英] what's the relationship between Selenium RC and WebDriver?

查看:30
本文介绍了Selenium RC 和 WebDriver 之间的关系是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以看到从selenium 2.0开始,WebDriver和Selenium RC是打包在一起下载的.现在我主要使用 WebDriver,但是我可以不时在我的测试脚本中引入 Selenium RC 吗?有什么是 Selenium RC 能做而 WebDriver 不能做的,反之亦然?

I can see that since selenium 2.0, WebDriver and Selenium RC are packaged together for download. Now I primarily use WebDriver, but can I bring in Selenium RC in my testing scripts from now and then? Is there anything that Selenium RC is capable of but WebDriver is not, or vice versa?

推荐答案

你可能应该从这里开始你的研究(虽然你可能已经看过了):http://seleniumhq.org/docs/03_webdriver.html

You should probably start your research here (though you may have already gone over this): http://seleniumhq.org/docs/03_webdriver.html

我假设您将 Selenium-RC 与 WebDriver 进行对比,Selenium-IDE 确实不在同一个范围内.

I'll assume you're contrasting Selenium-RC to WebDriver, Selenium-IDE really isn't in the same ballpark.

Selenium 使用 JavaScript 来自动化网页.这使它与 Web 内容非常紧密地交互,并且是最早支持 Ajax 和其他高度动态页面的自动化工具之一.然而,这也意味着 Selenium 在 JavaScript 沙箱中运行.这意味着您需要运行 Selenium-RC 服务器来绕过同源策略,这有时会导致浏览器设置出现问题.

Selenium uses JavaScript to automate web pages. This lets it interact very tightly with web content, and was one of the first automation tools to support Ajax and other heavily dynamic pages. However, this also means Selenium runs inside the JavaScript sandbox. This means you need to run the Selenium-RC server to get around the same-origin policy, which can sometimes cause issues with browser setup.

另一方面,WebDriver 使用来自每种语言的本机自动化.虽然这意味着支持新的浏览器/语言需要更长的时间,但它确实提供了更接近浏览器的感觉".如果您对 WebDriver 感到满意,请坚持下去,它就是未来.目前存在一些限制和错误,但如果它们没有阻止您,那就去做吧.

WebDriver on the other hand uses native automation from each language. While this means it takes longer to support new browsers/languages, it does offer a much closer 'feel' to the browser. If you're happy with WebDriver, stick with it, it's the future. There are limitations and bugs right now, but if they're not stopping you, go for it.

Selenium 优于 WebDriver

  • 支持多种浏览器和多种语言,WebDriver 需要针对每种新语言/浏览器组合进行本机实现.
  • 非常成熟和完整的 API
  • 目前(2010 年 9 月)支持 JavaScript 警报并更好地确认

WebDriver 与 Selenium 相比的优势

  • 本机自动化速度更快,出错和浏览器配置的可能性更低
  • 不需要运行 Selenium-RC 服务器
  • 访问无头 HTMLUnit 可以让测试运行得非常快
  • 很棒的 AP​​I

这篇关于Selenium RC 和 WebDriver 之间的关系是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆