Answer the question
In order to leave comments, you need to log in
setPreference() property not being set?
Test environment:
Firefox ver.47.0.2
Selenium WebDriver ver.2.53.1
Eclipse ver.Mars.2 Release (4.5.2)
Question:
To
begin with, the default user.js file is missing in the Firefox profile. Why is that? Created it. Next, I run a code that should overwrite the default property "general.useragent.override" from the prefs.js file (although there is no such property in this file, also "why so?").
package com.webdriver.chapter4;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SettingPreferences {
public static void main(String[] args) {
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("general.useragent.override", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7");
FirefoxDriver driver = new FirefoxDriver(profile);
driver.get("http://www.google.by");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question