动态生成的跨度属性的Puppeteer选择器
我正在尝试在Salesforce Lightning页面上获取跨度的文本,但是在每个页面上,跨度标签都有不同的属性。
我要选择的元素看起来像这样:
< span force-lookup_lookup =“” data-proxy-id =“ aura-pos-lib-9” id =“ window”> sfdc admin<//跨度>
因此,基于此选择器将为[data-proxy-id =“ aura-pos-lib-9”] [id =“ window”]
,
但是在相同的跨度不同页面上的同一位置(视觉上)是:
< span force-lookup_lookup =“” data-proxy-id =“ aura-pos-lib-17” id =“ window”> sfdc admin< /span>
更不用说[data-proxy-id =“ aura-pos-lib-9”] [id =“ window”]
可能包含来自完全不同字段的信息在另一页上。
如何选择动态变化的元素并将其内容(在这种情况下为SFDC Admin)保存到变量?
先感谢您。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论