我正在为Gmail编写Chrome扩展程序时,除了我的上一个任务:从Popup调用/触发一封新的撰写电子邮件外,几乎所有工作都已完成,因为我仍在寻找正确的方法为此。
一些注意事项:
这是我的内容脚本的示例代码:
if (request.message === 'FROM_POPUP.NEW_EMAIL') {
// Trying to get the Compose button on current page
// The selector is just for illustration purpose. In real code it
// would take a bit to find and decide the correct one.
const button = document.querySelector('button[Compose]')
// Trigger clicking event on Compose button
button & button.click();
}
到目前为止,这是我的方法,但是某种程度上新的撰写邮件没有显示出来。有什么合适的方法可以解决这个问题吗?
预先感谢