java - How to pass argument in firefoxprofile? -
to avoid hardcoding of pathname download folder, using xml file store pathname.
here code:
public class driver { //public static webdriver driver=new firefoxdriver(ffprofile()); public static webdriver driver=new firefoxdriver(ffprofile(downloadpath)); // method handle firefox browser profile //public static firefoxprofile ffprofile() public static firefoxprofile ffprofile(string downloadpath) { firefoxprofile profile = new firefoxprofile(); //string downloadpath="c:\\users\\xxxx\\downloads"; profile.setpreference("browser.download.folderlist", 2); profile.setpreference("browser.download.dir", downloadpath); profile.setpreference("browser.download.manager.alertonexeopen", false); profile.setpreference("browser.helperapps.neverask.savetodisk", "application/vnd.ms-excel,application/msword, application/csv, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream"); profile.setpreference("browser.download.manager.showwhenstarting", false); profile.setpreference("browser.download.manager.focuswhenstarting", false); profile.setpreference("browser.download.usedownloaddir", true); profile.setpreference("browser.helperapps.alwaysask.force", false); profile.setpreference("browser.download.manager.alertonexeopen", false); profile.setpreference("browser.download.manager.closewhendone", true); profile.setpreference("browser.download.manager.showalertoncomplete", false); profile.setpreference("browser.download.manager.usewindow", false); profile.setpreference("services.sync.prefs.sync.browser.download.manager.showwhenstarting", false); profile.setpreference("pdfjs.disabled", true); return profile; } }
now issue there error in line:
public static webdriver driver=new firefoxdriver(ffprofile(downloadpath));
error is:
downloadpath cannot resolved variable.
the snap of xml file:
<parameter name="downloadpath" value="c:\\users\\xxxxx\\downloads"/>
please guide me how handle error?
Comments
Post a Comment