Skip to content Skip to sidebar Skip to footer

Handling Mozilla Firefox Download Box Through Robot Framework Using Selenium2library

Page Should Contain Button xpath = /html/body/blockquote/form/p/input Click Button xpath = /html/body/blockquote/form/p/input Confirm Action The 'Confirm Acti

Solution 1:

Selenium cannot handle the browser's download box. A workaround is to disable the download popup. You'll have to make a library which sets the Firefox settings and download path:

def create_profile(path):
from selenium import webdriver
fp =webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.download.dir",path)
fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/plain") //the MIME type(s) for which you want to ignore the popup

fp.update_preferences()
return fp.path

Then import the library in your testsuite:

*** Settings ***
Library | path/to/library

And set the Firefox profile when you open the browser:

Open Browser | ${url} | ff | ff_profile_dir=path/to/download/folder

Post a Comment for "Handling Mozilla Firefox Download Box Through Robot Framework Using Selenium2library"