I'm interested in seeing the network tab in an extension's background page while running tests using Cypress.
When I go to chrome://extensions and click background page within the Cypress browser nothing pops up. I've also tried navigating directly to chrome-extension://(extension-id)/_generated_background_page.html but this stops the extension from working entirely.
Related
I am developing a Chrome extension with Parcel and when I refresh any page, my Chrome extension's icon will do the reloading animation (it disappears and quickly animated in from the right). This is a problem because it seems to be resetting my background script which contains some variables that need to persist. I'm not sure where to look because there aren't any errors logged.
I want to debug a chrome extension downloaded from chrome store. is it possible and how.
I have readium chrome extension and it is not working properly. I want to know why.
Thanks
If the extension run front-end scripts: right click on the page, Inspect > Sources tab > Content scripts tab. Then you can select the Chrome extension that not work correctly and add a breakpoint for example.
If the extension run back-end scripts: Go to this url: chrome://extensions then scroll to your extension and click on background page button. A popup will be opened and you can go to the sources tab and debug the script.
I am learning to write chrome extensions. Sometimes ,i do want to learn from the examples given on the chrome developer site. As the instruction says, i need a browser_action or a page_action, then right click ,then inspect popup. I am wondering whether there is other ways to debug the chrome extension.
And the other thing is , i have to write "window.reload(true)" in the debug console to reload the popup page, is there a better or more convenient way to do it?
Of course it's not needed. Your extension either has a popup of some sorts, a background script of some sorts, or a content script of some sorts.
You already know how to debug a popup.
To debug a background page, you can go to chrome://extensions/ with Developer mode enabled. Then you'll see a "background page" link next to extensions that have them - you can click that link to bring up Dev Tools for the extension.
To debug a content script, you should look into the page's own Dev Tools. The console output will be displayed alongside normal console. To type code in the console to execute in the extension's context, you need to change the the context from <top frame> to the extension in the UI:
Depends on what you want to debug.
Chrome extensions also have background page and content-scripts.
Background page console you can find here: open chrome://extensions/ and under extension you'll see "Inspect views".
Content-scripts print messages to the page console.
Popup and other pages you can open in normal tab and inspect in its console. They are accessible by the url: "chrome-extension://YOUR_EXTENSION_ID/path/to/popup.html"
When there's a problem in the content or background script, I do not get any error messages outputted in the console. Neither will it print anything to the console via console.log('msg'). except when I do alert() explicitly.
I am copying and pasting the javascript in the console manually to catch errors, but there must be a better way of debugging a chrome extension script.
There are two consoles, one for your popup and one for the background pages. You're probably looking at the wrong one.
You can access the popup console by right clicking your extension's icon and selecting Inspect Popup and clicking the console tab in the top right.
You can access the background console by going to chrome://extensions and selecting Background Page which is to the right of Inspect views by your extension.
Make sure you're in developer mode. If you're not sure how to enter that, check out https://developer.chrome.com/extensions/getstarted
I have developed a google chrome extension and I have a badge on the icon that displays a number.
When I start the browser the badge is not displayed. So I think I have to load the extension when chrome browser was started.
Is that possible?
Code in a background page is executed when a new browser window is created.