3

Saucelabs:-

https://saucelabs.com/

Am creating the firefox driver on saucelabs using the following:-

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
        capabilities.setCapability("version", "5");
        capabilities.setCapability("platform", Platform.XP);
        // Create the connection to Sauce Labs to run the tests
        this.driver = new RemoteWebDriver(
                new URL("http://YOUR_USERNAME:YOUR_ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub"),
                capabilities);
    }

I want to use the mobile user agent using firefox driver. How can i do it.

Sam
  • 4,294
  • 9
  • 35
  • 77

1 Answers1

1

Have you tried creating a new profile and setting the user agent string on the profile?

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("general.useragent.override", "UA-STRING");

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
shri046
  • 1,028
  • 10
  • 12