• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

220
Views
¿Cómo puedo manejar la ventana emergente de descarga de archivos para safari usando nightwatch?

Estoy tratando de usar algo como esto, similar a mis opciones de Firefox, pero mi prueba no parece manejar la ventana emergente de descarga, ¿alguna sugerencia? Gracias

 "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' }, } } }

Descubrí que había publicaciones existentes que podrían proporcionar algo de contexto

  • cómo manejar la descarga de archivos para selenium webdriver para safari
  • Cómo configurar la ubicación de descarga de Safari - Selenium WebDriver
about 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hay algunos métodos de Selenium para cambiar de ventana, que puede ver en este artículo: https://saucelabs.com/blog/selenium-tips-working-with-multiple-windows

Si tuviera que almacenar la ID de la ventana original, use el método switchTo() y vaya a la ventana original, con suerte puede manejar cualquier problema al interactuar con la ventana emergente de descarga:

 //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);

Consulte los documentos de Selenium para obtener ejemplos adicionales: https://www.selenium.dev/documentation/webdriver/browser_manipulation/#switching-windows-or-tabs .

No estoy seguro si esto ayuda, ¡avísame!

about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error