1package org.shakespeareframework.selenium;2import org.openqa.selenium.Capabilities;3import org.openqa.selenium.ImmutableCapabilities;4import org.openqa.selenium.WebDriver;5import org.openqa.selenium.chrome.ChromeOptions;6import org.openqa.selenium.edge.EdgeOptions;7import org.openqa.selenium.firefox.FirefoxOptions;8import org.openqa.selenium.ie.InternetExplorerOptions;9import org.openqa.selenium.opera.OperaOptions;10import org.openqa.selenium.safari.SafariOptions;11import static java.util.Arrays.stream;12/**13 * {@link Enum} of all browser types which are supported by {@link WebDriverSupplier}.14 */15public enum BrowserType {16 /**17 * Google Chrome18 */19 CHROME(org.openqa.selenium.chrome.ChromeDriver.class, new ChromeOptions()),20 /**21 * Mozilla Firefox22 */23 FIREFOX(org.openqa.selenium.firefox.FirefoxDriver.class, new FirefoxOptions()),24 /**25 * Opera26 */27 OPERA(org.openqa.selenium.opera.OperaDriver.class, new OperaOptions()),28 /**29 * Microsoft Edge30 */31 EDGE(org.openqa.selenium.edge.EdgeDriver.class, new EdgeOptions()),32 /**33 * Microsoft Internet Explorer34 */35 IEXPLORER(org.openqa.selenium.ie.InternetExplorerDriver.class, new InternetExplorerOptions()),36 /**37 * Apple Safari38 */39 SAFARI(org.openqa.selenium.safari.SafariDriver.class, new SafariOptions());40 private final Class<? extends WebDriver> webDriverClass;41 private final ImmutableCapabilities baseCapabilities;42 BrowserType(Class<? extends WebDriver> webDriverClass, Capabilities baseCapabilities) {43 this.webDriverClass = webDriverClass;44 this.baseCapabilities = ImmutableCapabilities.copyOf(baseCapabilities);45 }46 /**47 * Looks up the named {@link BrowserType}, ignoring case.48 *49 * @param string the desired browser type as {@link String}50 * @return the desired {@link BrowserType} if known51 * @throws IllegalArgumentException if the given string does not equal any {@link BrowserType#name()}52 */53 public static BrowserType forName(String string) {54 return stream(values())55 .filter(browserType -> browserType.name().equalsIgnoreCase(string))56 .findAny()57 .orElseThrow(() -> new UnsupportedBrowserTypeException(string));58 }...