I need to translate a page from Japanese to English, using selenium in chrome browser. I tried different ways one of sample code snippet is as following
import j
You need to enable translate and add target language ID to the whitelist {"from" : "to"}
.
"translate":{"enabled":"true"}
"translate_whitelists": {"ja":"en"}
in java:
Map<String, Object> prefs = new HashMap<String, Object>();
Map<String, Object> langs = new HashMap<String, Object>();
langs.put("ja", "en");
prefs.put("translate", "{'enabled' : true}");
prefs.put("translate_whitelists", langs);
options.setExperimentalOption("prefs", prefs);