[SOLVED] Angular: Select Dropdown item where all parameters are included in value-attribute

Ask general questions here.
mrt
Posts: 36
Joined: Mon Mar 16, 2020 11:31 am

[SOLVED] Angular: Select Dropdown item where all parameters are included in value-attribute

Post by mrt » Fri Jul 31, 2020 11:20 am

Hey folks,

I am struggling on how to set/validate items on a custom dropdown element.

It is written in Angluar JS, and it is a pure pain to automate this.
I know Ranorex struggles on Angular, but I havent found any other automation env which provides a decent GUI, recorder and reporting.

I cannot use the item's labels inside the shadow DOM, because developers are frequently changing structure and appearance inside there. They tell me to use the "interface", which will not be changed. This interface is provided through an array on items[ ] which is exposed through the value attribute of the element.

So using a DOM explorer on a dropdown item it gives me the following:

Code: Select all

<custom-item value="{"_id":"5ba9566baebe0b967536832a","name":"My Name","index":2,"key":"my-name"}" </custom-item>
So I cannot get/set the "My Name" property by using Ranorex's standard get/set value functions which I love, also identification for mouse click is not really possible with the RegEx "contains", because on similar names I get misidentification.

Is there ANY way to get/set the value of this dropdown?

Is it possible to change Ranorex model behind or do something squeaky,
so I do not have to write a user code, extract all from the value-attribute, change it to my needs and write the whole string back?
I got several of those dropdowns, so I am afraid the TestSuite in Ranorex would get unreadable and hardly maintainable pretty quick.

thank you

EDIT: Is it somehow possible to include my own RegEx expressions in Ranorex? This way I could probably parse the string as i need it.
Last edited by mrt on Fri Jul 31, 2020 1:25 pm, edited 1 time in total.

mrt
Posts: 36
Joined: Mon Mar 16, 2020 11:31 am

Re: Angular: Select Dropdown item where all parameters are included in value-attribute

Post by mrt » Fri Jul 31, 2020 1:25 pm

I made it, using Regex in the Repo Path:

Code: Select all

.../tag[@tagname='custom-item' and @value~'name":"([^"]*'+$varName+')']
which parses the JSON inside and gives me the value of the name-property.

thanks anyway!