Silk Test Object Maps

Last edited on

SilkTest object maps are XML files with "real names" that are expressed in XPath. To convert such a file into a script-based object map (SOM), we can generate a names.py (if we are using Python), by parsing the XML and also the XPath strings using a script like the one attached.

The script below uses eulxml to parse XPath, so you may need to pip install eulxml before using this script.

silkmapconvert.py

Here is an example silk test object map file:

<ObjectMap version="1">
  <ObjectMapEntry id="SHM" locator="/WPFWindow[@caption='HemoSphere*']">
    <ObjectMapEntry id="AdjustScalesFrame" locator="//WPFUserControl[@className='AdjustScalesFrame']">
      <ObjectMapEntry id="AdjustScalesFrame_ButtonLower0" locator="//WPFButton[@automationId='buttonLower0']" />
      <ObjectMapEntry id="AdjustScalesFrame_ButtonLower1" locator="//WPFButton[@automationId='buttonLower1']" />
...