Merging Object Maps During Action Recording

When you record actions with Silk4NET, Silk4NET checks if existing object map entries can be reused. Silk4NET checks this directly during recording, when a new locator is generated. Silk4NET checks if the object that is currently recorded in the application under test exactly matches an existing object map entry, and if yes, Silk4NET reuses the object map identifier from the object map.

This behavior has the following benefits:
  • Silk4NET correctly reuses an object map identifier during recording, even if the locator in the object map has changed.
  • A recorded script cannot contain wrong object map identifiers, and therefore will never fail to play back because of a wrong object map identifier.
  • If you restructure your object map, for example by adding an additional level of hierarchy, the object map identifiers are still reused.

Example

Silk4NET records the following script when you click on the Products link in the Micro Focus website, http://www.borland.com.

With _desktop.BrowserApplication( "borland_com" )
  With .BrowserWindow( "BrowserWindow" )
    .DomLink( "Products" ).Click( MouseButton .Left, New Point (47, 18))
  End With
End With
The recorded object map looks like this:
borland_com                           //BrowserApplication
  BrowserWindow                                //BrowserWindow
    Products                                     //A[@textContents='Products']
You could now manually restructure the object map to include the header section of the Micro Focus website:
borland_com                           //BrowserApplication
  BrowserWindow                                //BrowserWindow
    header                                       //HEADER[@role='banner']
      Products                                     //A[@textContents='Products']
When you now record a click on the Products link the object map is reused correctly, and the following script is recorded:
With _desktop.BrowserApplication( "borland_com" )
  With .BrowserWindow( "BrowserWindow" )
    .DomElement("header").DomLink( "Products" ).Click( MouseButton .Left, New Point (47, 18))
  End With
End With
Note: When you record another object in the header section of the Micro Focus website, for example the About link, Silk4NET adds the About object map entry as a child of BrowserWindow, and not of header.