Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
506 views
by Contributing Tester (92 points)
retagged by
I am trying to set Firefox profile so that "File Download" pop-up is not appeared. It works absolutely fine when I run on my machine without using Grid, however when I trigger execution through Grid firefox profile don't get set.

Could you please guide?
by The go-to Tester (181 points)
Can you post your code which is setting up Firefox profile? Also, can you post any error it is throwing?
by Contributing Tester (92 points)
public static FirefoxProfile FirefoxDriverProfile() throws Exception
    {
        ProfilesIni allProfiles = new ProfilesIni();
        //FirefoxProfile myProfile = allProfiles.getProfile("default");
       
        FirefoxProfile profile = allProfiles.getProfile("default");     //new FirefoxProfile();
        profile.setPreference("browser.download.folderList", 2);
        profile.setPreference("browser.download.manager.showWhenStarting", false);
        profile.setPreference("browser.download.dir", "\\INAIRDT541539\\downloads"/*getPath(Constants.DOWNLOADPATH)*/);
        profile.setPreference("browser.helperApps.neverAsk.openFile", "text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml");
        profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml");
        profile.setPreference("browser.helperApps.alwaysAsk.force", false);
        profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
        profile.setPreference("browser.download.manager.focusWhenStarting", false);
        profile.setPreference("browser.download.manager.useWindow", false);
        profile.setPreference("browser.download.manager.showAlertOnComplete", false);
        profile.setPreference("browser.download.manager.closeWhenDone", false);       
        profile.setPreference("webdriver.log.file", "c:\\temp\\firefox.log");
        profile.setAcceptUntrustedCertificates(true);
        profile.setAssumeUntrustedCertificateIssuer(true);
        return profile;
    }

caps = DesiredCapabilities.firefox();
                    caps.setBrowserName("firefox");                   
                    caps.setPlatform(Platform.WINDOWS);
                    caps.setCapability(FirefoxDriver.PROFILE, FirefoxDriverProfile());
            driver = new RemoteWebDriver(new URL("http://<IP Address>:5566/wd/hub"), caps.firefox(), caps);

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

I see that you are storing your downloads on intranet.

"\\INAIRDT541539\\downloads"

Are you sure that this pat is accessible by the user who is running the node on the node machine?

Also, make sure that path in

 

profile.setPreference("webdriver.log.file", "c:\\temp\\firefox.log");

 

is a valid path on the node machine. Let me know your comments.

...