Using the Google Chrome Inspect tool, I discovered that the Gmail Compose window offers HTML Element Ids for each of the fields. For example, the Subject field id
is ":h7
".
Since we have the Element Id, it is easier to just use the document.getElementById()
method, rather than using XPath.
So, I used this JavaScript to set the Subject field:
var subjectElem = document.getElementById(":h7")
subjectElem.value = "My TEST Subject"
You would, of course, put all of the JavaScript in a JavaScript in Browser Action.
Hopefully this will be enough to get you started. Good luck!