¿Cómo manejar los desafíos comunes de Selenium usando Python?

Contenidos

0tuzjszfeo1zbjosa-6625651
Foto por Olav Ahrens Røtne sobre Unsplash

Cómo descargar archivos usando Selenium WebDriver

import os

download_dir = os.getcwd()# current working directory

profile = webdriver.FirefoxProfile()

profile.set_preference("browser.download.folderList", 2) # the custom location specified browser.download.dir is enabled when browser.download.folderList equals 2
profile.set_preference('browser.download.dir', download_dir)
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.download.dir", path)
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', CONTENT_TYPE)
profile.set_preference("webdriver_enable_native_events", False)
profile.set_preference("browser.download.manager.scanWhenDone",False)
profile.set_preference("browser.download.manager.useWindow",False)
profile.set_preference("browser.helperApps.alwaysAsk.force",False)
profile.update_preferences()

browser = webdriver.Firefox(firefox_profile=profile)
Interfaz gráfica para recuperar tipo MIME
Suscribite a nuestro Newsletter

No te enviaremos correo SPAM. Lo odiamos tanto como tú.