| 40 | import org.openqa.selenium.safari.SafariOptions; |
| 41 | |
| 42 | public enum Browser { |
| 43 | ALL(new ImmutableCapabilities(), "any", false), |
| 44 | CHROME(new ChromeOptions(), new ChromeDriverInfo().getDisplayName(), true) { |
| 45 | @Override |
| 46 | public Capabilities getCapabilities() { |
| 47 | ChromeOptions options = new ChromeOptions(); |
| 48 | |
| 49 | resolveDriverPath("webdriver.chrome.driver"); |
| 50 | String binary = InProject.resolveRunfilesPath(System.getProperty("webdriver.chrome.binary")); |
| 51 | if (binary != null) { |
| 52 | options.setBinary(binary); |
| 53 | } |
| 54 | |
| 55 | if (Boolean.getBoolean("webdriver.headless")) { |
| 56 | options.addArguments("--headless"); |
| 57 | } |
| 58 | |
| 59 | options.addArguments( |
| 60 | "disable-infobars", |
| 61 | "disable-breakpad", |
| 62 | "disable-dev-shm-usage", |
| 63 | "no-sandbox", |
| 64 | "disable-search-engine-choice-screen"); |
| 65 | |
| 66 | // Accept self-signed and invalid certificates for HTTPS testing |
| 67 | options.setAcceptInsecureCerts(true); |
| 68 | |
| 69 | Map<String, Object> prefs = new HashMap<>(); |
| 70 | prefs.put("exit_type", "None"); |
| 71 | prefs.put("exited_cleanly", true); |
| 72 | options.setExperimentalOption("prefs", prefs); |
| 73 | |
| 74 | options.enableBiDi(); |
| 75 | |
| 76 | // Reason: https://github.com/SeleniumHQ/selenium/pull/14429#issuecomment-2311614822 |
| 77 | options.setCapability(UNHANDLED_PROMPT_BEHAVIOUR, "ignore"); |
| 78 | |
| 79 | return options; |
| 80 | } |
| 81 | }, |
| 82 | EDGE(new EdgeOptions(), new EdgeDriverInfo().getDisplayName(), true) { |
| 83 | @Override |
| 84 | public Capabilities getCapabilities() { |
| 85 | EdgeOptions options = new EdgeOptions(); |
| 86 | |
| 87 | resolveDriverPath("webdriver.edge.driver"); |
| 88 | String binary = InProject.resolveRunfilesPath(System.getProperty("webdriver.edge.binary")); |
| 89 | if (binary != null) { |
| 90 | options.setBinary(binary); |
| 91 | } |
| 92 | |
| 93 | if (Boolean.getBoolean("webdriver.headless")) { |
| 94 | options.addArguments("--headless"); |
| 95 | } |
| 96 | |
| 97 | options.addArguments( |
| 98 | "disable-extensions", |
| 99 | "disable-infobars", |
nothing calls this directly
no test coverage detected