For context, I’m using the Web Application: Whatsapp Web.
To identify the latest message element from a given chat, you can’t use the text or “aaname” attribute because that’s what you want to get in the first place. If you remove the “aaname” attribute, an “idx” attribute is generated, because the remaining attributes are not sufficient to identify a given message from the rest, which now have identical attributes.
To get the latest message element, I instead had to use an anchor base, which looked like this:
So far so good.
The latest message is saved to a UiElement variable, which now contains all the attributes of that message element, including the “aaname” attribute. I can now get its text by using messageElement.Get(“aaname”).ToString
But since the “aaname” aatribute is now present, the “idx” attribute is no longer necessary to identify that message from all the others, and therefore I cannot get its value with the following expression: messageElement.Get(“idx”).ToString. It just returns a null value, because the message is unique, now that the “aaname” attribute is included.
Is there a way to get an UiElement variable’s idx when compared to other elements of the same class, but ignoring the “aaname” attribute?