diff --git a/java/src/org/openqa/selenium/remote/Browser.java b/java/src/org/openqa/selenium/remote/Browser.java index f4e391d62b8f7..cca7bb661cd7d 100644 --- a/java/src/org/openqa/selenium/remote/Browser.java +++ b/java/src/org/openqa/selenium/remote/Browser.java @@ -23,34 +23,34 @@ /** Used to identify a browser based on its name. */ public interface Browser { - Browser CHROME = () -> "chrome"; - Browser EDGE = + Browser CHROME = new Browser() { @Override public String browserName() { - return "MicrosoftEdge"; + return "chrome"; } @Override public boolean is(String browserName) { - return browserName().equals(browserName) || "msedge".equals(browserName); + return Browser.super.is(browserName) || "chrome-headless-shell".equals(browserName); } }; - Browser HTMLUNIT = () -> "htmlunit"; - Browser IE = () -> "internet explorer"; - Browser FIREFOX = () -> "firefox"; - Browser OPERA = + Browser EDGE = new Browser() { @Override public String browserName() { - return "opera"; + return "MicrosoftEdge"; } @Override public boolean is(String browserName) { - return browserName().equals(browserName); + return Browser.super.is(browserName) || "msedge".equals(browserName); } }; + Browser HTMLUNIT = () -> "htmlunit"; + Browser IE = () -> "internet explorer"; + Browser FIREFOX = () -> "firefox"; + Browser OPERA = () -> "opera"; Browser SAFARI = new Browser() { @Override @@ -58,21 +58,12 @@ public String browserName() { return "safari"; } - public boolean is(String browserName) { - return browserName().equals(browserName) || "Safari".equals(browserName); - } - }; - Browser SAFARI_TECH_PREVIEW = - new Browser() { @Override - public String browserName() { - return "Safari Technology Preview"; - } - public boolean is(String browserName) { - return browserName().equals(browserName); + return Browser.super.is(browserName) || "Safari".equals(browserName); } }; + Browser SAFARI_TECH_PREVIEW = () -> "Safari Technology Preview"; String browserName();