com.testvagrant.optimus.core.web.FirefoxDriverManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of optimus-lite Show documentation
Show all versions of optimus-lite Show documentation
Optimus Lite API to manage test devices and create appium driver based on platform
package com.testvagrant.optimus.core.web;
import com.testvagrant.optimus.core.parser.WebTestFeedParser;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import java.util.Map;
class FirefoxDriverManager {
private final FirefoxOptions firefoxOptions;
public FirefoxDriverManager(WebTestFeedParser testFeedParser) {
this.firefoxOptions = buildFirefoxOptions(testFeedParser);
}
public WebDriver createDriver() {
WebDriverManager.firefoxdriver().setup();
return new FirefoxDriver(firefoxOptions);
}
private FirefoxOptions buildFirefoxOptions(WebTestFeedParser testFeedParser) {
Map capabilities = testFeedParser.getDesiredCapabilities().asMap();
Map preferences = testFeedParser.getPreferences();
FirefoxOptions options = new FirefoxOptions();
FirefoxProfile profile = new FirefoxProfile();
preferences.forEach((preference, value) -> profile.setPreference(preference, (String) value));
capabilities.forEach(options::setCapability);
options.setProfile(profile);
return options;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy