Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

590
Views
Chrome Console Script roto: TypeError no detectado: no se pueden leer las propiedades de undefined (leyendo 'push')

Estoy usando el siguiente código en la página de solicitud de seguimiento de Instagram para abrir a cada usuario en una nueva pestaña y luego dejar de seguirlo.

https://www.instagram.com/accounts/access_tool/current_follow_requests

 var i=0; var unfollow="global"; var final="global"; var link=["link","link2"]; var proWindow=[""] proWindow.length=0 link.length=0; var ids = document.querySelectorAll(".-utLf"); for(i=0;i<ids.length;i++){ link.push('https://www.instagram.com/'+ids[i].innerText+'/'); console.log(link[i]); proWindow[i]=window.open(link[i]); }

y luego el siguiente código para dejar de seguir a cada usuario:

 for(i=0;i<ids.length;i++){ unfollow = proWindow[i].document.querySelector("button.sqdOP"); unfollow.click(); await new Promise(resolve => setTimeout(resolve, 1000)); final = proWindow[i].document.querySelector(".aOOlW"); final.click();} console.log("Completed");

sin embargo, veo el siguiente error en la consola Uncaught TypeError: Cannot read properties of undefined (reading 'push')

Anteriormente, esto funcionaba bien, pero ahora muestra este error.

¿Qué cambio se debe hacer para corregir este código?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Este error se origina al intentar insertar algo indefinido en una matriz. Eso podría suceder si la lista de nodos devuelta por el selector de consulta contiene algo con un texto interno indefinido por alguna razón.

Esto debería funcionar mejor:

 if (ids[i].innerText){ // To check if the value is undefined link.push('https://www.instagram.com/'+ids[i].innerText+'/'); console.log(link[i]); proWindow[i]=window.open(link[i]); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!