How to match dynamic class values

Hi Plankton

do you know if UI Vision RPA has capability to support dynamic class values. e.g. using wildcard (*) to replace dynamic part of the class value.

E.g. this class name changes upon every deployment.
ClassName = css-1l4qc9r-Box-Card where 1l4qc9r is dynamic.

Thanks

Ui.Vision supports XPath locators and thus you can use them for partial class name matching:

In your case the locator would be

  • xpath=//*[starts-with(@class, “css-”)]

  • or maybe xpath=//*[ends-with(@class, “Box-Card”)]

Example macro:

{
  "Name": "dynamic class name",
  "CreationDate": "2023-3-27",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://omayo.blogspot.com/",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "xpath=//*[starts-with(@class, \"classo\")]",
      "Value": "box1",
      "Description": "Partial match of class name"
    },
    {
      "Command": "type",
      "Target": "xpath=(//*[@class=\"classone\"])[2]",
      "Value": "",
      "Description": "second xpath match"
    }
  ]
}

See also Dynamic IDs and How to click a button with a changing ID (partial ID match)?

1 Like