Selenium

From iMacros
Jump to: navigation, search

A comparison of iMacros and Selenium features, methods and commands.

This page is work in progress and not complete (yet).

Features

Things Selenium can do but not iMacros

  • Safari support (run tests, no IDE)
  • Opera support (run tests, no IDE)
  • Generate code (iMacros has a different approach. iMacros is an encapsulated object that can be called from any language)
  • Free


Things iMacros can do but not Selenium


Essential features both applications have

  • Fully documented commands and specification
  • Test scripts can be easily edited
  • Single-step debugging
  • Unicode support
  • Scheduling
  • Remote Control
  • Active user forums

IDE

Selenium IDE:

  • Available for Firefox 2/3.

iMacros IDE:

  • Available for Firefox 2/3
  • Available for Internet Explorer 6/7/8

In iMacros the "IDE" and core are integrated and run directly in the web browser. The advantage of this approach is that iMacros works with many more websites than Selenium, since it has access to more browser functions. In Selenium the IDE and replay core are different tools written (only) in Javascript. The advantage of this approach is the wider browser support (Safari).

Commands

iMacros Selenium Comments
URL GOTO open
TAG clickAndWait Selenium uses "target" values to define an element, iMacros uses the TAG command's POS, TYPE and ATTR attributes.
TAG type iMacros uses the optional CONTENT field of the TAG command for entering text
FRAME selectFrame iMacros uses the frame number instead of frame name


Selenium commands come in three 'flavors': Actions, Accessors and Assertions. Each command call is one line in the test table of the form:

 command  target  value

iMacros commands are structured similarly, but that the target part consists of three attributes:

 command  pos type attr value

For examples of the iMacros approach please see also TAGs and HTML and this example page.

Actions are commands that generally manipulate the state of the application. They do things like "click this link" and "select that option". If an Action fails, or has an error, the execution of the current test is stopped.

Selenium: Many Actions can be called with the "AndWait" suffix, e.g. "clickAndWait". This suffix tells Selenium that the action will cause the browser to make a call to the server, and that Selenium should wait for a new page to load.

iMacros uses the TAG command for this and automatically detects if a command triggers a call to the server and it has to wait. Therefore it does not need an equivalent to "AndWait".


Selenium: Accessors examine the state of the application and store the results in variables, e.g. "storeTitle". They are also used to automatically generate Assertions.

iMacros uses its data extraction features for this. For data extraction the "value" parameter is replaces with the extract paramenter

 command  pos type attr extract=<type>


Selenium: Assertions are like Accessors, but they verify that the state of the application conforms to what is expected. Examples include "make sure the page title is X" and "verify that this checkbox is checked".

iMacros: All TAG commands are automatically assertions so no special command is required. For the rare case that you want to ignore errors, use SET !ERRORIGNORE YES


Selenium: All Selenium Assertions can be used in 3 modes: "assert", "verify", and "waitFor". For example, you can "assertText", "verifyText" and "waitForText". When an "assert" fails, the test is aborted. When a "verify" fails, the test will continue execution, logging the failure. This allows a single "assert" to ensure that the application is on the correct page, followed by a bunch of "verify" assertions to test form field values, labels, etc.

"waitFor" commands wait for some condition to become true (which can be useful for testing Ajax applications). They will succeed immediately if the condition is already true. However, they will fail and halt the test if the condition does not become true within the current timeout setting (see the setTimeout action below).

iMacros: The TAG command automatically uses "assert" and "waitfor" mode as this is the option you will need in 95% of all cases. The "waitfor" time is controlled by the timeout value. If you prefer to use a behavior like Selenium "verify", then add SET !ERRORIGNORE YES to the macro. Then the test will continue execution, only logging the failure.


Selenium: Element Locators tell Selenium which HTML element a command refers to. Many commands require an Element Locator as the "target" attribute. Examples of Element Locators include "elementId" and "document.forms[0].element".

iMacros: The iMacros element locator is the TAG command. It splits the element location in 3 parts:

  • POS=x : x-th matching element
  • TYPE=y : The type (A, B, FONT,...)
  • ATTR= : The attributes that specify the element further, such as HREF, TXT or ID.

Assertions

Selenium has a huge number of of assertions: assertErrorOnNext, assertFailureOnNext, assertNotFailureOnNext, verifyErrorOnNext, verifyNotErrorOnNext, verifyFailureOnNext, verifyNotFailureOnNext, waitForErrorOnNext, waitForNotErrorOnNext, waitForFailureOnNext, waitForNotFailureOnNext, assertSelected, assertSelectedLabel, assertSelectedValue, assertSelectedIndex, assertSelectedId, assertNotSelected, verifySelected, verifyNotSelected, waitForSelected waitForNotSelected

iMacros: All assertions are done automatically by the TAG command in iMacros. Any encountered error is logged and/or reported via the Scripting Interface iimPlay command. See also How can I search for a keyword?.


Selenium has a huge number of of "store" commands: storeAlert, storeAllButtons, storeAllFields, storeAllLinks, storeAttribute, storeBodyText, storeConfirmation, storeCursorPosition, storeElementHeight, storeElementIndex, storeElementPositionLeft, storeElementPositionTop, storeElementWidth, storeLocation, storePrompt, storeSelectedId, storeSelectedIds, storeSelectedIndex, storeSelectedIndexes, storeSelectedLabel, storeSelectedLabels, storeSelectedValue, storeSelectedValues, storeSelectOptions, storeTable, storeText, storeTitle, storeValue, storeAlertPresent, storeChecked, storeConfirmationPresent, storeElementPresent, storeOrdered, storePromptPresent, storeSomethingSelected, storeTextPresent, storeVisible

iMacros: All this information (and more) can be saved via the web data extraction feature



Note: We see this page as documentation to help you find the best possible tool for your task. If you find any mistakes or missing information please notify us or simply edit the page yourself.