1

I need to start Firefox / Chrome using remote webdriver with a specific browser language. I know how to do it while running locally. But is it possible to start a remote webdriver with specifying browser language.

Swaroop Tata
  • 89
  • 10

1 Answers1

0

This is how object creation done is RemoteWebDriver,

WebDriver driver = new RemoteWebDriver(new URL("http://localhost:PORT_NUMBER/"), DesiredCapabilities.firefox());

Profiller is the key here,

var fp = new FirefoxProfile();
fp.SetPreference("intl.accept_languages", "en-au");
desiredCap.SetCapability(FirefoxDriver.ProfileCapabilityName,fp.ToBase64String());

your code seems specific to chrome so you can use this, I hope this might help you,

var options = new ChromeOptions();
options.AddArgument("--lang=zh"); // this sets US english 
desiredCap.SetCapability(ChromeOptions.Capability, options);
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:PORT_NUMBER/"), desiredCap.chrome());

Possible duplicate of How to set Browser Language using RemoteWebDriver

Ashish Kamble
  • 2,555
  • 3
  • 21
  • 29