I'm currently troubleshooting a bug in my Gmail Google Chrome extension where I need to identify when the Rich Format bar is visible. Unfortunately, all the ids and classes are encrypted and unreliable.
To locate the message canvas
this.canvas_frame_document.evaluate("//iframe[contains(@class, 'editable')]",
this.canvas_frame_document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
and to find the Rich Text bar
this.canvas_frame_document.evaluate("//img[@command='+underline']",
this.canvas_frame_document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
This method works effectively for composing new emails because the canvas dom is present and detectable.
However, it doesn't work when replying, replying to all, or forwarding emails because the dom changes dynamically and
chrome.tabs.onSelectionChanged.addListener
cannot detect page changes like it does for Compose.