com.teststeps.thekla4j.browser.selenium.Selenium Maven / Gradle / Ivy
package com.teststeps.thekla4j.browser.selenium;
import com.teststeps.thekla4j.browser.config.BrowserConfig;
import com.teststeps.thekla4j.browser.config.BrowserName;
import com.teststeps.thekla4j.browser.core.Browser;
import com.teststeps.thekla4j.browser.selenium.config.SeleniumConfig;
import io.vavr.*;
import io.vavr.control.Option;
import io.vavr.control.Try;
import lombok.extern.log4j.Log4j2;
import java.util.Objects;
import java.util.function.Function;
import static com.teststeps.thekla4j.browser.selenium.functions.ConfigFunctions.loadBrowserConfig;
import static com.teststeps.thekla4j.browser.selenium.functions.ConfigFunctions.loadSeleniumConfig;
import static io.vavr.API.*;
@Log4j2(topic = "Selenium Browser Load")
public class Selenium {
/**
* Load the Browser from the configuration
*
* @return a Try of the Browser
*/
public static Browser browser() {
return loadBrowser.apply(Option.none())
.getOrElseThrow((e) -> new RuntimeException(e));
}
public static Browser browser(String testName) {
return loadBrowser.apply(Option.of(testName))
.getOrElseThrow((e) -> new RuntimeException(e));
}
/**
* Load the Browser from the configuration
*/
private static final Function1