page-modeller icon indicating copy to clipboard operation
page-modeller copied to clipboard

Allow to specify a unique property instead of ID

Open emerisier opened this issue 3 years ago • 1 comments

Very good tool, it would be perfect if we could tell the SPY to look at another unique property instead of the id

<input class="form-control ng-pristine ng-invalid ng-touched" formcontrolname="prenom" type="text" placeholder="Nom" style="null">

image

manual trick

  1. create id with the same value of formcontrolname
  2. after export i replace id by original property

elements = document.querySelectorAll('[formcontrolname]:not([id])') elements.forEach((item, index) => { value = item.getAttribute('formcontrolname') item.setAttribute('id', value) })

image

emerisier avatar Nov 07 '22 13:11 emerisier

Thanks, If there aren't many elements with that locator attribute, then you could just edit the model and update the locator, before generating the code:

image

That said, maybe it's useful to allow users to provide a list of 'custom attributes of interest' which could be included when scanning.

danhumphrey avatar Nov 08 '22 02:11 danhumphrey

Closing as this request is very specific to single user and can already be achieved by editing the locators.

danhumphrey avatar Aug 01 '24 02:08 danhumphrey