Community in read only mode June 18 & 19
This community will be set in READ ONLY mode for a while on Tuesday June 18 into Wednesday June 19 while we import content and users from our Micro Focus Forums community site. MORE INFORMATION
Varinderdeep Absent Member.
Absent Member.
362 views

Wild Card

Hi

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.

Thanks

0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

RE: Wild Card

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)

Michael

0 Likes
Varinderdeep Absent Member.
Absent Member.

RE: Wild Card

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.
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Wild Card

Hi,

.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?

 

 

Michael

0 Likes
Highlighted
Varinderdeep Absent Member.
Absent Member.

RE: Wild Card

It works. Thank you so much Michel
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.