自动化Firefox和Chrome浏览器 [英] Automating Firefox and Chrome browsers

查看:255
本文介绍了自动化Firefox和Chrome浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一种方式来自动化夫妇浏览器......从外部应用程序/流程Firefox和Chrome(目前只在Windows中)。

I am looking for a way to automate couple of browsers... Firefox and Chrome (for now on just Windows) from an external application/process.

有没有办法做沿着这些线路的东西:

Is there a way to do things along these lines:


  1. 用URL启动浏览器

  2. 让浏览器加载网页,运行脚本等。

  3. 检查DOM

有关参考,IE可以使用它可以在一个shell脚本创建的InternetExplorer.Application对象使用下面的JavaScript自动化,然后我可以走了DOM API:

For reference, IE can be automated using the InternetExplorer.Application object which can be created in a shell script using the following javascript, and then I can walk the DOM API:

var ie = new ActiveXObject('InternetExplorer.Application');

这里的激励场景自动测试。我想加载包含测试code中的页面,并收集结果在测试运行后。

The motivating scenario here is automated testing. I'd like to load up the page containing the test code, and gather results after the test has run.

推荐答案

http://watin.sourceforge.net/

华廷正是这么做的,我相信他们最近添加了镀铬的支持

WatiN does exactly that, and I believe they recently added Chrome support

更新2011/6/22:
Currrently华廷仅适用于Firefox 2和3,不要在Firefiox 4(几乎肯定不会在Firefox 5,这是今天发布)。此外,这个答案的时候,据称是被添加铬的支持,但它看起来像从来没有完全成熟,现在没有列为其主页支载平台。

Update 6/22/2011: Currrently WatiN only works on Firefox 2 and 3, not in Firefiox 4 (and almost certainly not in Firefox 5, which was released today). Also, the time of this answer, Chrome support was supposedly being added, but it looks like that never got fully baked and now is not listed as a suported platform on their home page.

另外值得注意的,在我的经验,当我升级到IE9华廷有很多慢。我看到这两个不同的机器,并降级到IE8加速测试备份在两台机器上。

Also worth noting, in my experience WatiN got a lot slower when I upgraded to IE9. I saw this on two different machines, and downgrading to IE8 sped the tests back up on both machines.

我还在用大量华廷,但现在多为行为驱动的设计和功能的回归测试,这通常是不特定浏览器。然后,在FF和铬手动测试的所有测试进展

I still use WatiN heavily, but now mostly for behavior driven design and functional regression testing, which generally are not browser-specific. Then, manually test in FF and Chrome for all progression testing.

更新2015年9月22日:
Elmue是正确的,它看起来像不再正在处理华廷。我们已经寻找到硒对我们的自动化验收测试今: http://www.seleniumhq.org

Update 9/22/2015: Elmue is right, it looks like WatiN is no longer being worked on. We've looking into Selenium for our automated acceptance tests now: http://www.seleniumhq.org

这篇关于自动化Firefox和Chrome浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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