2

I want to be able to call functions that I am writing in a Chrome extension from the JS console in Chrome, so that I can test them easily and see how their output changes as the page changes.

But it seems as the functions I write aren't available to the chrome JS console. I don't really understand JS that well, or the chrome extension model, but I need to somehow inject the extension source into the body of the page that I am using the extension for?

Rob W
  • 341,306
  • 83
  • 791
  • 678
Rob Neuhaus
  • 9,190
  • 3
  • 28
  • 37
  • 1
    These pictures show where to find the features you're looking for: [animation for Content scripts](http://stackoverflow.com/a/15197993/938089) and [picture for background page](http://stackoverflow.com/a/10258029/938089). – Rob W Mar 24 '13 at 20:06

1 Answers1

6

If you are talking about functions that you defined in a background page, then you need to go to your extensions page, check the developer mode box, and click on _generated_background_page.html. That is where you will find your background page code.

If you mean functions in a content script, then when you are in the console, go down to where it says <page context> and change it to your extension. Then you will have access to the functions in the content script.

BeardFist
  • 8,031
  • 3
  • 35
  • 40