Saucelabs: -
https://saucelabs.com/
使用以下方法在saucelabs上创建firefox驱动程序: -
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);
}
我想使用firefox驱动程序使用移动用户代理。我怎么能这样做。
答案 0 :(得分:1)
您是否尝试过创建新配置文件并在配置文件中设置用户代理字符串?
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("general.useragent.override", "UA-STRING");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);