'Selecting value in drop down list in Chrome recorder

I am trying to record a web workflow using the Chrome inbuilt recorder. When selecting a value from a drop down list, the following code is generated.

  "type": "click",
  "selectors": [
    [
      "aria/ Current Order - $1,023.34 total value"
    ],
    [
      "#fromOrder-menu-342-1"
    ]
  ],

The issue is that the total order value is included in the name of the drop-down list item, and this will never be the same for two different orders.

How can I change the selector (e.g. using wildcards, or just check for "starts with") to select the relevant value from the drop-down list (regardless of the ending text of the drop down list value description)?



Solution 1:[1]

You could make use of Attribute selectors by using [attr^=value] to grab an element based on the value it "starts with".

Assuming your desired element has an aria-label this works:

[aria-label^="? Current Order - "]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 theDavidBarton