Wild Card


How to use Wild Card to capture dynamic value in Dialog of Window application?

 With.Dialog("RFQ Outright  CANDEAL BOND   1010319024004711")

In this code, 1010319024004711 is a dynamic value which changes with every run.

Please advise.


  • Hi,

    Use the * wildcard in your locator.

    "RFQ Outright CANDEAL BOND 1010319024004711" in your example looks like a object map id. Open the object map and change the locator to use * instead of the number. For example, change //Dialog[@caption='RFQ Outright CANDEAL BOND 1010319024004711'] to //Dialog[@caption='RFQ Outright CANDEAL BOND*']

    You might also want to change the name object map entry itself to make it easier to read (e.g. to just "RFQ Outright CANDEAL BOND" without a number)


  • In reply to michaelg:

    I tried With .Dialog("RFQ Outright CANDEAL BOND *")
    But it did not work. Also if I don't put the number, it does not recognize the object.
  • In reply to Varinderdeep:


    .Dialog("RFQ Outright CANDEAL BOND *") will not work because this means: "use the Xpath locator from object entry with the name 'RFQ Outright CANDEAL BOND *'".

    Background info: An object map is a test asset that contains items that associate a logical name (an alias) with a control or a window, rather than the control or window's locator. Once a control is registered in an object map asset, all references to it in visual tests and scripts are made by its alias, rather than by its actual locator name. Only XPath locators support wilcards but names of object map entries do not support wildcards. 


    You can do the following to fix your script:

    • first change your script back to With .Dialog("RFQ Outright CANDEAL 1010319024004711")
    • find the object map that contains the dialog and open it
    • In the object map change the value of the "locator path" column from //Dialog[@caption='RFQ Outright CANDEAL 1010319024004711'] to //Dialog[@caption='RFQ Outright CANDEAL *']

    Does your script work with those changes?

    If no, what is the error message that you get?




  • In reply to michaelg:

    It works. Thank you so much Michel