torus's avatar
torus
Contributor
7 months ago
Status:
New Idea

Ability to get the get/extract the XPath or Css from the name mapping objects

I would like to have one location where I specify the xpath my html elements. Most of the time, this data is stored in the NameMapping. A lot of the time you can use aliases in scripts. However, there are some times ... like for the 'waitelement' which you have to use the xpath or css. I would really like to be able to get the xpath or css from the nameMapping. This would make things a lot safer and less error prone. I use keyword tests as much as I can, but there are times when scripting is beneficial. 

 

var myAlias = Aliases.MyWebApp.AdminButton;

var selectorArray = myAlias.GetSelectors();

 

the selectorArray would be an array of objects that looks like this:

selectorArray = [{'css', '#myAdminButton'}, {'xpath', '//div/button[contains(@class, 'adminbutton')]'}, {'xpath', //div//button}]

1 Comment

  • For the above, it would also be critical to be able to get the xpath or css-selectors regardless of whether or not the element currently exists on the page