Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
¿Cómo copio al portapapeles usando clipboardy?

Estoy tratando de usar el portapapeles para copiar 'longlat' en el portapapeles pasándolo a través de la función 'copyData ()'. Sin embargo, me sigue dando errores.

Este es el error (1. Clipboardy.writeSync no es una función y 2. UnhandledPromiseRejectionWarning):

 (node:16596) UnhandledPromiseRejectionWarning: TypeError: clipboardy.writeSync is not a function at copyData (C:\Users\Nicky\index.js:46:14) at C:\Users\Nicky\index.js:32:13 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:16596) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:16596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

este es mi codigo

 const clipboardy = (...args) => import('clipboardy').then(({default: clipboardy}) => clipboardy(...args)); const puppeteer = require("puppeteer"); const url = "https://www.google.com/"; async function StartScraping() { await puppeteer .launch({ headless: false, }) .then(async (browser) => { const page = await browser.newPage(); await page.setViewport({ width: 2000, height: 800, }); page.on("response", async (response) => { if (response.url().includes("General")) { const location = await response.text() let intlong = location.indexOf("Example:") const longlat = location.substring(intlong, intlong + 46) console.log(longlat); copyData(longlat) } }); await page.goto(url, { waitUntil: "load", timeout: 0, }); }); } function copyData(data1) { clipboardy.writeSync(data1) } StartScraping();
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

cy.window().its('navigator.clipboard') .invoke('readText').then((data) => { console.log(data); })

Debería hacer el truco. Si está utilizando Cypress en el navegador

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda