OperaOptions createOperaOptions(Config config, Proxy proxy) { OperaOptions operaOptions = new OperaOptions(); if (config.headless()) { throw new InvalidArgumentException("headless browser not supported in Opera. Set headless property to false."); } if (!config.browserBinary().isEmpty()) { log.info("Using browser binary: " + config.browserBinary()); operaOptions.setBinary(config.browserBinary()); } operaOptions.merge(createCommonCapabilities(config, proxy)); return operaOptions; } }
private OperaOptions getInitializedOperaOptions() { if (this.operaOptions == null) { this.operaOptions = new OperaOptions(); } return this.operaOptions; }
private OperaOptions getInitializedOperaOptions() { if (this.operaOptions == null) { this.operaOptions = new OperaOptions(); } return this.operaOptions; }
/** * Задает options для запуска Opera драйвера * options можно передавать, как системную переменную, например -Doptions=--load-extension=my-custom-extension * @return operaOptions */ private OperaOptions getOperaDriverOptions(DesiredCapabilities capabilities) { log.info("---------------Opera Driver---------------------"); OperaOptions operaOptions = !options[0].equals("") ? new OperaOptions().addArguments(options) : new OperaOptions(); operaOptions.setCapability(CapabilityType.BROWSER_VERSION, loadSystemPropertyOrDefault(CapabilityType.BROWSER_VERSION, VERSION_LATEST)); operaOptions.merge(capabilities); return operaOptions; }
DesiredCapabilities capabilities = DesiredCapabilities.operaBlink(); OperaOptions options = new OperaOptions(); options.addArguments("private"); capabilities.setCapability(OperaOptions.CAPABILITY, options);
Optional<Object> testInstance) throws IOException, IllegalAccessException { OperaOptions operaOptions = new OperaOptions();
/** * Returns a {@link Capabilities} instance which is completely same as that one that is contained in the configuration * object itself - there is no necessary properties to be set. * * @param configuration * A configuration object for Drone extension * @param performValidations * Whether a potential validation should be performed; * if set to true an IllegalArgumentException (or other exception) can be thrown in case requirements are not met * * @return A {@link Capabilities} instance */ public Capabilities getCapabilities(WebDriverConfiguration configuration, boolean performValidations) { DesiredCapabilities capabilities = new DesiredCapabilities(configuration.getCapabilities()); new OperaDriverBinaryHandler(capabilities).checkAndSetBinary(performValidations); String binary = PropertySecurityAction.getProperty(OPERA_BINARY_KEY); if (Validate.empty(binary)) { binary = (String) capabilities.getCapability(OPERA_BINARY_KEY); } OperaOptions operaOptions = new OperaOptions(); CapabilitiesOptionsMapper.mapCapabilities(operaOptions, capabilities, BROWSER_CAPABILITIES); if (Validate.nonEmpty(binary)) { if (performValidations) { Validate.isExecutable(binary, "Opera binary must point to an executable file, " + binary); } operaOptions.setBinary(binary); } capabilities.setCapability(OperaOptions.CAPABILITY, operaOptions); return capabilities; }
/** * Returns a {@link Capabilities} instance which is completely same as that one that is contained in the configuration * object itself - there is no necessary properties to be set. * * @param configuration * A configuration object for Drone extension * @param performValidations * Whether a potential validation should be performed; * if set to true an IllegalArgumentException (or other exception) can be thrown in case requirements are not met * * @return A {@link Capabilities} instance */ public Capabilities getCapabilities(WebDriverConfiguration configuration, boolean performValidations) { DesiredCapabilities capabilities = new DesiredCapabilities(configuration.getCapabilities()); new OperaDriverBinaryHandler(capabilities).checkAndSetBinary(performValidations); String binary = PropertySecurityAction.getProperty(OPERA_BINARY_KEY); if (Validate.empty(binary)) { binary = (String) capabilities.getCapability(OPERA_BINARY_KEY); } OperaOptions operaOptions = new OperaOptions(); CapabilitiesOptionsMapper.mapCapabilities(operaOptions, capabilities, BROWSER_CAPABILITIES); if (Validate.nonEmpty(binary)) { if (performValidations) { Validate.isExecutable(binary, "Opera binary must point to an executable file, " + binary); } operaOptions.setBinary(binary); } capabilities.setCapability(OperaOptions.CAPABILITY, operaOptions); return capabilities; }