Haha, I already found a solution. Since I didn't find a dedicated method, I used something like this:
//get xpath from mapped element
function GetXpathFromAlias(mappedElement)
{
const str = mappedElement.Name; // returns something like this "FindElement(\"//parent::div//following-sibling::div[@class='editFormTabs']//*[name()='mat-form-field' or name()='mat-button-toggle' or name()='mat-radio-button' or name()='mat-checkbox' and not(@class='mat-button-toggle-group') and not(@class='ripple')]//*[name()='mat-label' or contains(@class,'toggle-label') or @class='mat-checkbox-label' or @class='mat-radio-label-content' and not (contains(@class,'container')) and not (contains(.,''))]\")"
const pattern = /\"(\/\/.*?(\')?\])\"/;
const match = pattern.exec(str);
if (match)
{
const xpath = match[1];
return xpath;
} else
{
Log.Error("XPath not found." + str);
}
}
Just a little reminder, this method will return xpath only if it starts with '//' and ends with ']'.