Page Should Contain Button xpath = /html/body/blockquote/form/p/input
Click Button xpath = /html/body/blockquote/form/p/input
Confirm Action
The 'Confirm Action' keyword is supposedly used to select OK in an alert box, which is not happening in the above case. In my opinion, Selenium2Library is not treating the download box as an alert box, because when I tried Get Alert Message, I'm receiving an output saying 'No alert box found'.
In what way can I select the OK in the download box? Also, the test case should be dependent on Selenium2Library keywords only. No external Python APIs can be used.
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