Automatically Run a Script in my Browser console after opening a link using Python
<p>I want to run some JavaScript in my browser DevTools console. So far, I have opened up a specific website only through it. Can it be done in Python?</p>

<p>Right now, I am using the following code:</p>

<pre><code>url = 'http://some-website.com/'

webbrowser.open(url)
</code></pre>

<p>What I want to do now is open up the DevTools console panel and then run a script through it automatically? Can it be done by using Python or some other tool along with Python?</p>

<p>I don't belive this can be done, as </p>

<blockquote>
  <p>ChromeDriver 2 and the DevTools windows both compete for the same
  automation channel, and ChromeDriver automatically closes the DevTools
  window in order for it to work.</p>
</blockquote>

<p>See here for more: <a href="http://stackoverflow.com/questions/18420769/chrome-developer-tools-closes-instantly-when-attempting-to-debug-webdriver-e2e-t">Chrome Developer Tools closes instantly when attempting to debug WebDriver E2E test</a></p>

javascript python selenium google-chrome-devtools