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; } }
/** * Sets the path to the Opera executable. This path should exist on the * machine which will launch Opera. The path should either be absolute or * relative to the location of running OperaDriver server. * * <br> * Example: * <pre> * $.driver().useOpera().withBinary(new File("C:/Program Files/Opera/49.0.2725.47/opera.exe")).autoDriverDownload(); * </pre> * Note: this is an alias to {@link OperaOptions#setBinary(File)} . * * @param path Path to Opera executable. * @return A self reference, allowing further configuration. * @since 0.18.0 */ public OperaDriverBuilder withBinary(File path) { getInitializedOperaOptions().setBinary(path); return this; }
/** * Sets the path to the Opera executable. This path should exist on the * machine which will launch Opera. The path should either be absolute or * relative to the location of running OperaDriver server. * * <br> * Example: * <pre> * $.driver().useOpera().withBinary(new File("C:/Program Files/Opera/49.0.2725.47/opera.exe")).autoDriverDownload(); * </pre> * Note: this is an alias to {@link OperaOptions#setBinary(File)} . * * @param path Path to Opera executable. * @return A self reference, allowing further configuration. * @since 0.18.0 */ public OperaDriverBuilder withBinary(File path) { getInitializedOperaOptions().setBinary(path); return this; }
/** * Sets the path to the Opera executable. This path should exist on the * machine which will launch Opera. The path should either be absolute or * relative to the location of running OperaDriver server. * * <br> * Example: * <pre> * $.driver().useOpera().withBinary("C:/Program Files/Opera/49.0.2725.47/opera.exe").autoDriverDownload(); * </pre> * Note: this is an alias to {@link OperaOptions#setBinary(String)} . * * @param path Path to Opera executable. * @return A self reference, allowing further configuration. * @since 0.18.0 */ public OperaDriverBuilder withBinary(String path) { getInitializedOperaOptions().setBinary(path); return this; }
/** * Sets the path to the Opera executable. This path should exist on the * machine which will launch Opera. The path should either be absolute or * relative to the location of running OperaDriver server. * * <br> * Example: * <pre> * $.driver().useOpera().withBinary("C:/Program Files/Opera/49.0.2725.47/opera.exe").autoDriverDownload(); * </pre> * Note: this is an alias to {@link OperaOptions#setBinary(String)} . * * @param path Path to Opera executable. * @return A self reference, allowing further configuration. * @since 0.18.0 */ public OperaDriverBuilder withBinary(String path) { getInitializedOperaOptions().setBinary(path); return this; }
operaOptions.setBinary(binary.value());
((OperaOptions) options).setBinary("/usr/bin/opera");
/** * 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; }