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

268
Vistas
How can I handle file download pop up for safari using nightwatch

I am trying to use something like this, similar to my firefox options, but my test doesn't seem to handle the download pop-up, any suggestions ? Thank you

"safari": {
      "downloadFolder": "Users/chef/Downloads/",
      "desiredCapabilities": {
        "browserName": "Safari",
        'safari:safariOptions': {
          prefs: {
            'safari.options.dataDir':'Users/chef/Downloads/',
            'safari.helperApps.neverAsk.saveToDisk':'image/jpeg;application/binary;application/pdf;text/plain;application/text;text/xml;application/xml;text/html;text/csv;video/mp4'
          },
        }
      }
    }

I found there were exisitng posts that might provide some context

  • how to handle file downlaod for selenium webdriver for safari
  • How to set Safari download location - Selenium WebDriver
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There are some Selenium methods to switch windows, which you can see in this article: https://saucelabs.com/blog/selenium-tips-working-with-multiple-windows

If you were to store the ID of the original window then use the switchTo() method and go to the original window, hopefully you can handle any issues with interacting with the download pop-up:

//Store the ID of the original window
const originalWindow = await driver.getWindowHandle();

//Check we don't have other windows open already
assert((await driver.getAllWindowHandles()).length === 1);

//Click the link which opens in a new window
await driver.findElement(By.linkText('new window')).click();

//Wait for the new window or tab
await driver.wait(
    async () => (await driver.getAllWindowHandles()).length === 2,
    10000
  );

//Loop through until we find a new window handle
const windows = await driver.getAllWindowHandles();
windows.forEach(async handle => {
  if (handle !== originalWindow) {
    await driver.switchTo().window(handle);
  }
});

//Wait for the new tab to finish loading content
await driver.wait(until.titleIs('Selenium documentation'), 10000);

See the Selenium Docs for additional examples: https://www.selenium.dev/documentation/webdriver/browser_manipulation/#switching-windows-or-tabs.

Not sure if this helps, let me know!

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