Module 17- Video 3- Creating Profiling in firefox(UPDATED QUESTION) | Selenium Forum
M
mp.mca2005 Posted on 12/05/2020

Getting this error -

Failed to set preferences: Unable to read profile preferences file

package Downloading;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.ProfilesIni;

public class FirefoxDownload {

public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "//Users//ARLab07//Downloads//Driver//geckodriver 2");
FirefoxOptions ops = new FirefoxOptions();
//ProfilesIni allProf = new ProfilesIni();
FirefoxProfile pro = new FirefoxProfile();
pro.setPreference("browser.download.folderList", 2);
pro.setPreference("browser.download.dir", "//Users//ARLab07//Downloads");
pro.setPreference("browser.helperApps.neverAsk.savetoDisk", "application/vnd.openxmlformats-officedocument.wordprocessingml.document\n" );
ops.setProfile(pro);
WebDriver driver = new FirefoxDriver(ops);[For this line]
driver.get("https://file-examples.com/index.php/sample-documents-download/sample-doc-download/");
driver.findElement(By.xpath("/html/body/div[1]/main/section/div/div[2]/div/div/table/tbody/tr[1]/td[5]/a[1]")).click();
}

}

Please have a look and suggest any possible solution.
Thanks


A
Ashish Thakur Replied on 13/05/2020

Are you admin of pc

And on which line are you getting the error


M
mp.mca2005 Replied on 14/05/2020

No,I am not admin of PC. On this line - WebDriver driver = new FirefoxDriver(ops);


A
Ashish Thakur Replied on 14/05/2020

May I have screenshot of the error please

On windows this works OK

Which version of selenium are you using?


M
mp.mca2005 Replied on 17/05/2020

I am running this program on mac, not working for me.

Please check the screenshot

Version - selenium-java-3.141.59

 

Responsive image

A
Ashish Thakur Replied on 18/05/2020

Open firefox

type

about:config

 

Do the settings manually and check if it works

This is working fine on windows


Related Posts