/// <summary> /// Inicializa uma nova instância do OperaDriver /// </summary> /// <param name="folderPath">Pasta onde se encontra o Driver do Opera</param> /// <param name="preferences">Preferências do usuário. Opcional</param> /// <param name="options">Opções para configurar na inicialização do navegador. Ex: "headless"</param> private void OperaInstance(string folderPath, Dictionary <string, object> preferences = null, params string[] options) { if (string.IsNullOrEmpty(folderPath)) { throw new ArgumentException("É necessário passar o caminho que está localizado o Driver do Browser"); } OperaOptions operaOptions = new OperaOptions(); operaOptions.AddArguments(options); if (preferences != null) { foreach (KeyValuePair <string, object> preference in preferences) { operaOptions.AddUserProfilePreference(preference.Key, preference.Value); } } Driver = new OperaDriver(folderPath, operaOptions); }
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); }