Java Code Examples for org.openqa.selenium.firefox.FirefoxOptions#addArguments()
The following examples show how to use
org.openqa.selenium.firefox.FirefoxOptions#addArguments() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SeleniumIT.java From gaia with Mozilla Public License 2.0 | 5 votes |
@BeforeAll public static void openServerAndBrowser() throws IOException { FirefoxOptions options = new FirefoxOptions(); options.addArguments("-headless"); // ChromeOptions options = new ChromeOptions(); // options.addArguments( // "--headless", // "--disable-web-security", // "--allow-running-insecure-content", // "--ignore-certificate-errors"); driver = new FirefoxDriver(options); percy = new Percy(driver); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); }
Example 2
Source File: WebDriverTypeTests.java From vividus with Apache License 2.0 | 5 votes |
@Test @PrepareForTest(fullyQualifiedNames = "org.vividus.selenium.WebDriverType$1") public void testGetFirefoxWebDriverWithCommandLineArguments() throws Exception { String argument = "headless"; WebDriverConfiguration configuration = new WebDriverConfiguration(); DesiredCapabilities desiredCapabilities = testGetFirefoxWebDriver(configuration); FirefoxOptions expected = new FirefoxOptions(); expected.addArguments(argument); assertEquals(expected.asMap(), desiredCapabilities.asMap()); }
Example 3
Source File: AbstractCapabilities.java From carina with Apache License 2.0 | 5 votes |
private DesiredCapabilities addFirefoxOptions(DesiredCapabilities caps) { FirefoxProfile profile = getDefaultFirefoxProfile(); FirefoxOptions options = new FirefoxOptions().setProfile(profile); caps.setCapability(FirefoxOptions.FIREFOX_OPTIONS, options); // add all custom firefox args for (String arg : Configuration.get(Parameter.FIREFOX_ARGS).split(",")) { if (arg.isEmpty()) { continue; } options.addArguments(arg.trim()); } // add all custom firefox preferences for (String preference : Configuration.get(Parameter.CHROME_EXPERIMENTAL_OPTS).split(",")) { if (preference.isEmpty()) { continue; } // TODO: think about equal sign inside name or value later preference = preference.trim(); String name = preference.split("=")[0].trim(); String value = preference.split("=")[1].trim(); // TODO: test approach with numbers if ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) { options.addPreference(name, Boolean.valueOf(value)); } else { options.addPreference(name, value); } } return caps; }
Example 4
Source File: FirefoxSettings.java From aquality-selenium-java with Apache License 2.0 | 4 votes |
private void setFirefoxArgs(FirefoxOptions options) { logStartArguments(); for (String arg : getBrowserStartArguments()) { options.addArguments(arg); } }