Skip to content

Dynamic locator #649

@adrian2096

Description

@adrian2096

hi, im trying to make a dynamic locators like this

data/locators.yaml

DobleValue:
  newValue: {xpath: "//td[contains(@title,'${value}')]"}

the newValue locator is in the data/locators.yaml and im trying to use javascript to replace the '${value}' with a value that i send as a parameter, i try it to use like this but is not working, is there anyway how to make what i want?

- script: |
     var locatorString = $data("data/locators").DobleValue.newValue
     var newLocator = locatorString.replace("${plan}",$macroArgs.plan)

     $runMacro("macro", {
       locator: newLocator 
     });

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions