I am pretty new to C# and integrating with firefox.
So this might be a very basic newbie question :)
I have this code:
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
FirefoxOptions options = new FirefoxOptions();
options.setPreference("browser.download.folderList", 2);
options.setPreference("browser.download.dir", "C:\\Windows\\temp");
options.setPreference("browser.download.useDownloadDir", true);
options.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf");
options.setPreference("pdfjs.disabled", true); // disable the built-in PDF viewer
The setPreference is marked with red. It is not recognized.
I have following installed:
What is missing?
FirefoxOptions.SetPreference Method (String, Int32)
defines:
public void SetPreference(
string preferenceName,
int preferenceValue
)
So you need to replace:
options.setPreference("browser.download.folderList", 2);
With:
options.SetPreference("browser.download.folderList", 2);
FirefoxOptions.SetPreference Method (String, String)
defines:
public void SetPreference(
string preferenceName,
string preferenceValue
)
So you need to replace:
options.setPreference("browser.download.dir", "C:\\Windows\\temp");
options.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf");
With:
options.SetPreference("browser.download.dir", "C:\\Windows\\temp");
options.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf");
FirefoxOptions.SetPreference Method (String, Boolean)
defines:
public void SetPreference(
string preferenceName,
bool preferenceValue
)
So you need to replace:
options.setPreference("browser.download.useDownloadDir", true);
options.setPreference("pdfjs.disabled", true);
With:
options.SetPreference("browser.download.useDownloadDir", true);
options.SetPreference("pdfjs.disabled", true);