0
   const BrowserWindow = remote.BrowserWindow;

   const IGWin = new BrowserWindow({
       show: false,
       webPreferences: {
           plugins: true,
           allowDisplayingInsecureContent: true
       },

   });


   IGWin.loadURL('https://instagram.com');
   IGWin.once('ready-to-show', () => {
       IGWin.show();
       IGWin.title = "TEST";

       IGWin.webContents.on('did-finish-load', function() {
           setTimeout(function () {
               IGWin.webContents.executeJavaScript("$('input[name=username]').value = 1");
           }, 1100)

       });



   })

I get this error: https://i.stack.imgur.com/33RxQ.png

I have tried changing ' to " and " to " and " to `` and nothing worked, i don't know what cause this problem and i hope someone will let me know what to change in code because i already spent like 1 hour and i can't find solution. I will really appreciate if someone will solve this for me.

1 Answers1

0

$ is a function that is either defined by jQuery (which instagram.com does not use) or your console debug window but as that page states:

Warning: These functions only work when you call them from the Chrome DevTools Console. They won't work if you try to call them in your scripts.

If $ doesn't exist, $('...') will throw.

document.querySelector('input[name="username"]') (MDN) can be used to target a DOM node.

RickN
  • 12,537
  • 4
  • 24
  • 28