puppeteer: non-deterministic target loading

I’m trying to load a CRX i’m working on in puppeteer but can never get it load consistently. Almost every run gives different results:

browser = await puppeteer.launch({
  headless: false,
  args: [
    `--disable-extensions-except=${extPath}`,
    `--load-extension=${extPath}`
  ]
});

const targets = await browser.targets();

targets.forEach(x => {
  console.log(x._targetInfo.title, x._targetInfo.type);
});

Some runs show this (in varying order):

'CryptoTokenExtension' 'background_page'
'' 'page'
'' 'browser'

Other runs show:

'CryptoTokenExtension' 'background_page'
'' 'browser'
'' 'page'
'myext' 'background_page'

What am I doing wrong?

How to change source code chromium for update extensions from own server?

We are developing a chromium based browser for smm specialists. Also, we have an extension that needs to be installed and updated through our server.

In manifest extension I added update url:

"update_url": "https://super-smm.com/store/extensions/ciinbcgllnekeikkpgmchahilfcihfhp.xml"

On the server, I upload file ciinbcgllnekeikkpgmchahilfcihfhp.xml with such content:



    
        
    

But this doesn’t work! The extension does not update.
What should I change in Chromium source code for the extensions updating from own server?

ERROR at //chrome/browser/extensions/default_extensions/BUILD.gn:9:1: Invalid token

Help to understand. Followed the recommendation

Still gives an error. Please halp

ERROR at //chrome/browser/extensions/default_extensions/BUILD.gn:9:1: Invalid token.

enter image description here

Google chrome – localhost is unable to access extension

I have https://localhost which is accessing the chrome extension to read RS232 scanned barcode.

enter image description here

if(chrome && chrome.runtime && chrome.runtime.sendMessage) {
    chrome.runtime.sendMessage("23232323232eafdsfadsf", {greeting: "hello"}, function(response) {
      console.log('>>> what? ' , response, response.farewell);

      if(response.farewell==0) {

      } 
      else {

      }
    });
  }

But when i run the same script from real domain for example: https://www.stackoverflow.com it works without any problem.

enter image description here

Why https://localhost not working but https://www.stackoverflow.com works? How to make the https://localhost also work instead of real-domain?

NOTE: my application need to run without internet/intranet that is why i cant use real-domain but all in localhost. How can i fix it?

Return windows object using puppeteer

I’m trying to return the whole windows object from a page, and then traversing the object outside of puppeteer.

I’m trying to access the data in Highcharts property, for which I need to access the window object. The normal javascript code being something like window.Highcharts.charts[0].series[0].data.

I thought the easiest way would be to use puppeteer to access the site, and just send me back the windows object, which I could then use outside of puppeteer like any other JS object.

After reading the documentation, I’m finding it difficult to return the object as it would appear just putting ‘window’ into the chrome console. I’m not sure what I’m missing?

I’ve read through the documentation, and the following two methods seem like they should work?

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('https://www.example.com', {waitUntil: 'networkidle2'});

    // METHOD 1
    // Create a Map object
    await page.evaluate(() => window.map = new Map());
    // Get a handle to the Map object prototype
    const mapPrototype = await page.evaluateHandle(() => Map.prototype);
    // Query all map instances into an array
    const mapInstances = await page.queryObjects(mapPrototype);

    console.log(mapInstances);

    await mapInstances.dispose();
    await mapPrototype.dispose();

    // METHOD 2
    const handle = await page.evaluateHandle(() => ({window, document}));
    const properties = await handle.getProperties();
    const windowHandle = properties.get('window');
    const documentHandle = properties.get('document');
    var result = await page.evaluate(win => win, windowHandle);

    console.log(result)

    await handle.dispose();



    await browser.close();
})();

However, it only returns the following in the console, and not the simple object I would like;

enter image description here

Not sure if I’m going about this the right way, so any help/advice is much appreciated.

Chromium won’t launch extensions when started from command line

Having a weird issue with Chromium on a Raspberry Pi. I am trying to get the Chrome extension “Revolver” to auto start when I load up Chromium. I want it to cycle through each of my tabs right when I launch Chromium.

This works totally fine when I physically click on the Chromium icon, it launches Chromium and then the “Revolver” extension starts working and cycles through my tabs.

However, when I launch Chromium through the Raspberry Pi’s autostart file like this:

@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --enable-extension-apps --enable-extensions --enable-apps

It launches chrome, but the “Revolver” extension does not auto start. It will only work if I then click on the extension icon. I am not sure why it DOES auto start when I manually launch Chromium, but DOES NOT auto start when launching through the autostart file.

Any ideas?

Auto launch Chromium extension on launch

I have a Raspberry Pi and I want it to auto launch Chromium in fullscreen when it boots up. I also want to auto launch the Rotisserie URL Rotator as soon as Chromium loads so it will start rotating through my default tabs automatically.

I’ve looked into the extension’s manifest.json and there is the section for “background” but I am not sure what I’m supposed to do in order to get the extension to auto launch.

Error loading extension with localization

My nw.js app suddenly stopped working on Windows 10 with the following error;

Failed to load extension from {path}. Default locale is defined but default data couldn't be loaded.

Structure & manifest

_locales
 en
js/i18n.js

Manifest

"default_language": "en"

I don’t know what windows has changed recently but it has been working solidly on previous versions of Windows for years. I’ve updated the country tag as per available language packs for windows here and chromium tags but still no luck.

How does Google Chrome/Chromium Assigns loaderId to requests(as mentioned in google dev tools protocol)?

what id loaderId and how it is assigned as mentioned in following url?

see Page.navigate in https://chromedevtools.github.io/devtools-protocol/tot/Page , it return loaderId.

is it unique for each navigation request?

React render() method is not calling in runtime when i clicking a button in the electron app

i have a chrome extension and i made an electron app over it. i am using react js as a javascript frame work . i have like button and asset button which updates and render the component at runtime. its working in the chrome extension because of chrome.runtime API but in electron the react render method is not calling when i click a like button ,it is calling after i refresh the page .. Can you please help me out with this if anybody knows any runtime api for electron that will update and call the button component in the runtime .