title: Clicking a button on Google Docs through Chrome Extension
body: <p>I am trying to create a chrome extension that will click on a button on Google Docs when you click a button on the extension. Below is my attempt to this problem (this doesn't seem to work, I am just going with clicking Print button on the docs).</p>
  <p>manifest.json</p>
  <pre><code>{  
      &quot;manifest_version&quot;: 2,  
  
      &quot;name&quot;: &quot;Google Docs Button Click&quot;,  
      &quot;description&quot;: &quot;Google Docs Button Click Simulator&quot;,  
      &quot;version&quot;: &quot;1.0&quot;,    
      &quot;permissions&quot;: [&quot;tabs&quot;, &quot;http://*.docs.google.com/*&quot;,&quot;*://*/*&quot;],  
  
      &quot;browser_action&quot;: {  
          &quot;default_icon&quot;: &quot;cursor.png&quot;,  
          &quot;default_popup&quot;: &quot;popup.html&quot;  
      }
  }
  </code></pre>
  <p>popup.html</p>
  <pre><code>&lt;!doctype html&gt;  
  &lt;html&gt;  
      &lt;head&gt;&lt;title&gt;activity&lt;/title&gt;&lt;/head&gt;  
  &lt;body&gt;  
      &lt;button id=&quot;clickactivity&quot;&gt;click&lt;/button&gt;  
      &lt;script src=&quot;popup.js&quot;&gt;&lt;/script&gt; 
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  <p>popup.js</p>
  <pre><code>function injectTheScript() {
      chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
          chrome.tabs.executeScript(tabs[0].id, {file: &quot;content_script.js&quot;});
      });
  }
  
  document.getElementById('clickactivity').addEventListener('click', injectTheScript);
  </code></pre>
  <p>content_script.js</p>
  <pre><code>function clickButton() {
      var buttons = document.getElementById(&quot;printButton&quot;);
      buttons.click();
  }
  
  clickButton();
  </code></pre>
  <p>Please assist.</p>