Skip to content

Commit

Permalink
[java] Recognise chrome-headless-shell as Chrome browser (#13292)
Browse files Browse the repository at this point in the history
  • Loading branch information
valfirst authored Dec 12, 2023
1 parent dee5bc5 commit 10c0c28
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions java/src/org/openqa/selenium/remote/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,56 +23,47 @@
/** 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
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();

Expand Down

0 comments on commit 10c0c28

Please sign in to comment.