Open Twebst - 针对IE浏览器的Web自动化测试

jopen 11年前

Open Twebst是一个开源Web自动化框架,主要针对Internet Explorer浏览器,可以用在任何支持COM的环境,从脚本语言的JScript,VBScript到高级编程语言C#,VB.Net,VBA / Excel,Python,C++。

该框架包括两个部分组成:1、Open Twebst Web Recorder:自动生成大部分IE自动化代码。2、Open Twebst Library:一个可编程的对象集合,用于创建一个Web自动化API。

项目地址: http://open-twebst.codecentrix.com/
当前版本: 1.1
系统要求: Windows XP, Windows Vista, Windows 7 + IE 6.0 � 9.0
License & Pricing: open source, GPL v3 (http://www.gnu.org/licenses/gpl-3.0.html)
支持: for programming and features related questions about the product we strongly encourage you to use Twebst Google Group at: https://groups.google.com/forum/#!forum/twebst-automation-studio
安装: the installation runs smoothly through a NSIS installer.
文档: http://doc.codecentrix.com/ (the setup comes with a CHM help file as well).

特性:

  • Start new IE browsers and navigate to a specified URL.
  • Connect to existing browsers.
  • Get full programmatic control over HTML elements and frames.
  • Intuitive names for HTML elements using the text that appears on the screen.
  • Advanced search of browsers and HTML elements using wildcards.
  • Perform actions on all HTML controls (button, combo-box, list-box, edit-box, upload control).
  • Simulates user behavior generating hardware or browser events.
  • Get access to native interfaces exposed by Internet Explorer so you don't need to learn new things if you already know IE web programming.
  • Synchronize web actions and navigation by waiting the page to complete in a specified timeout.
  • Available from any programming/scripting language that supports COM
  • Optimized search methods and collections.
  • Easily create web macros through an intuitive graphical interface.
  • Generate web automation code using the language of your choice: Python, JScript, VBScript, C#, VB.Net, Watir.
  • Record web actions on all HTML web controls (anchor, button, combo-box, list-box, edit-box)

You can create a script simply recording your actions on the web page. Here is a picture of Open Twebst Web Recorder generating JScript code:

Open Twebst - 针对IE浏览器的Web自动化测试

Code sample:

var core = new ActiveXObject('OpenTwebst.Core');

var browser = core.StartBrowser('http://mail.yahoo.com/�);

browser.FindElement('input text', 'id=username').InputText('codecentrix');

browser.FindElement('input password', 'id=passwd').InputText('1234');

browser.FindElement('button', 'id=.save').Click();

The script above automates the login page on Yahoo email web site. First we need a Core object to start a new Browser. Once we have the browser object we can search for HTML objects inside the web page.

FindElement method waits the page to be completely loaded before searching the DOM. Its behavior can be customized using several properties like: loadTimeout, searchTimeout and loadTimeoutIsError.

Once we have the Element, we can perform actions on it like: Click, InputText, Select. These automation methods simulate user actions generating all the relevant HTML events on target object.

Random facts:

Open Twebst Library contains only 5 types of objects: Core, Browser, Frame, Element and ElementList.

Open Twebst Web Recorder supports the following languages: VBScript, JScript, C#, VB.Net, Python and Watir.

While looking for HTML objects inside DOM, the whole frame/iframe hierarchy is taken into account. It works even for frames/iframes loaded from different domains bypassing cross domain security restrictions.

It can automate pop-ups and HTML modal/modeless dialog boxes. See: ClosePrompt, ClosePopup, FindModelessHtmlDialog and FindModalHtmlDialog.

You can gain access to native IHTMLElement and IWebBrowser2 objects exposed by IE using nativeElement and nativeBrowser properties.

You can attach to existing IE browser and even IE web browser controls embedded in other applications using FindBrowser method.

Wildcards can be used when searching for HTML objects in the web page. See: Search Conditions.

It works with all Internet Explorer versions from 6.0 to 9.0 + support for protected mode.

Further Readings

Open Twebst web-site: http://open-twebst.codecentrix.com/

Documentation: http://doc.codecentrix.com/

Twebst Google Group: https://groups.google.com/forum/#!forum/twebst-automation-studio