예제 #1
0
        private static RemoteWebDriver StartOperaDriver(DriverSettings settings)
        {
            var options = new OperaOptions();

            settings.Capabilities?.ForEach(cap => options.AddAdditionalCapability(cap.Key, cap.Value));
            if (!string.IsNullOrEmpty(settings.BrowserBinaryPath))
            {
                options.BinaryLocation = settings.BrowserBinaryPath;
            }
            if (!string.IsNullOrEmpty(settings.Proxy))
            {
                options.Proxy = new Proxy {
                    HttpProxy = settings.Proxy
                }
            }
            ;
            if (settings.BrowserBinaryPath != null)
            {
                options.BinaryLocation = settings.BrowserBinaryPath;
            }
            if (settings.CmdArgs != null)
            {
                options.AddArguments(settings.CmdArgs);
            }
            if (settings.Extensions != null)
            {
                options.AddExtensions(settings.Extensions);
            }
            return(new OperaDriver(options));
        }
예제 #2
0
        private OperaOptions GetOperaDriverOptions()
        {
            OperaOptions options = new OperaOptions();

            if (_config.ExtensionsList.Count > 0)
            {
                options.AddExtensions(_config.ExtensionsList);
            }
            if (_config.ArgumentsList.Count > 0)
            {
                options.AddArguments(_config.ArgumentsList);
            }
            foreach (KeyValuePair <string, object> keyValuePair in _config.AdditionalCapability)
            {
                options.AddAdditionalCapability(keyValuePair.Key, keyValuePair.Value);
            }
            foreach (KeyValuePair <string, object> keyValuePair in _config.UserProfilePreferences)
            {
                options.AddUserProfilePreference(keyValuePair.Key, keyValuePair.Value);
            }

            return(options);
        }