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

137
Views
abrir la búsqueda de enlaces y luego cerrar javascript

Intento abrir enlaces, lo que encontré, en una nueva ventana, luego busco un texto y luego cierro la nueva ventana. Pero no funciona, la nueva ventana no se cierra y la búsqueda tampoco funciona. y acaba de abrir la primera ventana.

 links = document.getElementsByTagName("a"); for (var i = 0, l = links.length; i < l; i++) { var link = links[i]; if (link.href.indexOf("jooble") !== -1) { var newWindow = window.open(links[i].href); setTimeout(function(){ console.log("5s") if ( (newWindow.document.documentElement.textContent || newWindow.document.documentElement.innerText).indexOf('Jófogás') > -1) { console.log("Jófogás") } if(newWindow){ newWindow.close(); } }, 5000); } }`
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

desafortunadamente, no puede acceder a un contenido html de window.open .

 var mywindow = window.open('https://www.wikipedia.org/', 'title', 'height=500, width=500'); console.log(mywindow.document) //you will get an empty html tag

Tienes que usar una Web Scraper library como puppeteer para eso

about 4 years ago · Juan Pablo Isaza Report

0

No está creando la variable que es su problema, coloque let antes de los enlaces e intente nuevamente

 let links = document.getElementsByTagName("a"); for (var i = 0, l = links.length; i < l; i++) { var link = links[i]; if (link.href.indexOf("jooble") !== -1) { var newWindow = window.open(links[i].href); setTimeout(function(){ console.log("5s") if ( (newWindow.document.documentElement.textContent || newWindow.document.documentElement.innerText).indexOf('Jófogás') > -1) { console.log("Jófogás") } if(newWindow){ newWindow.close(); } }, 5000); } }
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!