I'm trying to get the text of a span on a Salesforce Lightning page, but on every page the span tag has different attributes.
The element i'm trying to select looks like this:
<span force-lookup_lookup="" data-proxy-id="aura-pos-lib-9" id="window">SFDC Admin</span>
So based on this the selector would be [data-proxy-id="aura-pos-lib-9"][id="window"]
However the same span in the same spot (visually speaking) on a different page is:
<span force-lookup_lookup="" data-proxy-id="aura-pos-lib-17" id="window">SFDC Admin</span>
Not to mention that [data-proxy-id="aura-pos-lib-9"][id="window"] might contain information from a completely different field on another page.
How can I select this dynamically changing element and save its contents (in this case SFDC Admin) to a variable?
Thank you in advance.