简体   繁体   中英

Selenium webdriver - Not able to set browser locale

I am trying to set the browser locale to Japanese. I am using the following piece of code :

FirefoxProfile profile = new FirefoxProfile();
//setting the locale japanese : ‘ja’
profile.setPreference(“intl.accept_languages”,”ja”);
driver = new FirefoxDriver(profile);

"intl" is not recognized on the eclipse editor. It says "intl" cannot be resolved to a local variable. Eclipse does not suggest any imports either. It asks me to create a local variable "intl".

I dont know any other way to go about this. Any suggestions ?

I think your quotes should be fixed. Replace:

profile.setPreference(“intl.accept_languages”,”ja”);

with:

profile.setPreference("intl.accept_languages", "ja");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM