Custom browser profile
Mobitru supports overriding browser profiles when you can prepare a custom browser profile locally,
archive it, and then use it as a base profile while executing tests.
This feature is available for Chrome and Firefox.
Enable in tests
To start using the custom browser profile, it’s necessary to add the context
option with a link to download an archive with the profile.
Important: a resource with the archive should be accessible from the Internet without additional authentication or user interaction.
Also, the option should be located inside the mobitru:options
map.
Below you can find an example for different programming languages:
public void startDriver() {
ChromeOptions chromeOptions = new ChromeOptions();
Map<String, Object> moonOptions = new HashMap<>();
moonOptions.put("context", "https://example-profile-storage.com/browser-profile.tar.gz");
chromeOptions.setCapability("mobitru:options", moonOptions);
RemoteWebDriver driver = new RemoteWebDriver(new URL("https://" + BILLING_UNIT+":" + ACCESS_TOKEN + "@browserhub-us.mobitru.com/wd/hub"), chromeOptions);
}
def start_driver():
options = webdriver.ChromeOptions()
mobitru_options = {
'context': 'https://example-profile-storage.com/browser-profile.tar.gz'
}
options.set_capability('mobitru:options', mobitru_options)
cloud_url = f"https://{BILLING_UNIT}:{ACCESS_TOKEN}@browserhub-us.mobitru.com/wd/hub"
return webdriver.Remote(cloud_url, options=options)
it('browser session init', async function () {
const mobitruOptions = {
'mobitru:options': {
'context': 'https://example-profile-storage.com/browser-profile.tar.gz'
}
}
let driver = new Builder()
.withCapabilities(mobitruOptions)
.forBrowser(Browser.CHROME)
.usingServer(`https://${BILLING_UNIT}:${ACCESS_TOKEN}@browserhub-us.mobitru.com/wd/hub`)
.build()
});