The Ranorex Web Plugins (for Microsoft Internet Explorer, Mozilla Firefox, Google Chrome and Chromium) allow you to test the UI of web applications in the same way you would automate standard desktop applications.
If you want to run tests on other OS and browser combinations, our Selenium WebDriver Integration is what you’re looking for.
In this chapter
You can find samples for testing various web technologies here.
Architecture of Websites in the Ranorex Framework
Ranorex is able to access the complete HTML architecture of a web document. Use the Ranorex Spy to analyze the structure and the content of a web application and to see which information is accessible during automation.
All open websites are shown as a single Dom node in the spy tree. In addition to standard browser hosted applications, Ranorex is able to see embedded browser objects too (e.g. compiled help files). Additional each tab item within a browser window is presented as a separate Dom node within the spy tree.
Representation of websites
The web document and its HTML structure can be identified using RanoreXPath. Similar to XPath in HTML, the RanoreXPath provides a simple search mechanism for finding single or multiple web elements within a web page.
The WebDocument Adapter creates a representation of the complete web-site including all tags (e.g. the header tag, body tag, etc.). Furthermore it offers useful ways to make your test scripts more effective.
The following sample shows how to use these features:
Find or filter Web Elements
The Ranorex Framework offers a wide range of adapters for each HTML tag elements (e.g.: ATag adapter for <a> tags). Each adapter has specific methods and attributes; the link tag (<a>) for example has additional attributes like HREF, TARGET and REL.
During the installation of Ranorex the setup package automatically installs add-ins for all supported browsers, which enable the communication between the Ranorex Browser Plug-In and the specific browser. If you have problems with instrumenting a specific browser use the Ranorex Instrumentation wizard as explained here.
Creating tests for Firefox does not differ to creating tests for Internet Explorer or any other supported browser. All web UI elements are specified through RanoreXPath, which uses HTML attributes and values for identification. For this reason a single web repository can be used for testing all supported types of web browsers. Learn more about how to test multiple browsers with a test case based on one single repository introduced by our web testing example project, which is part of the Ranorex setup package.
Automation of browser specific elements (e.g. Pop-Up window)
Handling of browser specific UI controls requires a separate RanoreXPath for each browser specific element. That means if you would like to click on a Pop-Up dialog in different browser, you will have to add a separate repository item for each dialog.
The Ranorex Automation library provides you with a property called ‘BrowserName’ which tells you the current browser of the web site under test:
Recordings & Repositories
Ranorex Recorder provides the same capture and replay functionality, which is used for standard client desktop applications. The recorder automatically creates action items for each recorded user action within the Recorder’s actions table. The corresponding repository contains all required UI web element objects used within the actions table.
Web based recording
Repositories and the WebDocument
The following example shows how to access the methods of the WebDocument using a repository: