public string GetDriverVersion(string browserVersion) { var driverVersion = String.Empty; if (browserVersion.Equals("Latest", StringComparison.InvariantCultureIgnoreCase)) { // look online bool onlineLookupSuccessful; try { driverVersion = GetLatestVersion(); onlineLookupSuccessful = true; } catch (Exception) { onlineLookupSuccessful = false; //Add Logging } //was it successful? if (!onlineLookupSuccessful) { //no /// look at dictoinary and get latest version stored return(CompatibilityHelper.GetLatestStoredVersion(BrowserName.Firefox)); } else { return(driverVersion); } } else { //search try { //get last compatible version of webdriver for given browser version driverVersion = CompatibilityHelper.GetCompatibleStoredVersion(BrowserName.Firefox, browserVersion); if (!string.IsNullOrWhiteSpace(driverVersion)) { return(driverVersion); } else { throw new ArgumentException("Unable to get 'driverVersion'"); } } catch (Exception ex) { throw ex; } } }
/// <summary> /// Gets the latest version. /// </summary> /// <returns></returns> public virtual string GetDriverVersion(string browserVersion) { try { if (browserVersion.Equals("Latest", StringComparison.InvariantCultureIgnoreCase)) { // look at dictoinary and get latest version stored return(CompatibilityHelper.GetLatestStoredVersion(BrowserName.EdgeChromium)); } else { // look at dictoinary and get matching version return(CompatibilityHelper.GetCompatibleStoredVersion(BrowserName.EdgeChromium, browserVersion)); } } catch (Exception ex) { throw new ArgumentException("Unable to get 'driverVersion'", ex.InnerException); } }
public string GetDriverVersion(string browserVersion) { var driverVersion = String.Empty; if (browserVersion.Equals("Latest", StringComparison.InvariantCultureIgnoreCase)) { // look online bool onlineLookupSuccessful; try { driverVersion = GetLatestVersion(); onlineLookupSuccessful = true; } catch (Exception) { onlineLookupSuccessful = false; //Add Logging } //was it successful? if (!onlineLookupSuccessful) { //no /// look at dictoinary and get latest version stored return(CompatibilityHelper.GetLatestStoredVersion(BrowserName.Opera)); } else { return(driverVersion); } } else { //search try { //get matching version driverVersion = CompatibilityHelper.GetCompatibleStoredVersion(BrowserName.Opera, browserVersion); if (!string.IsNullOrWhiteSpace(driverVersion)) { return(driverVersion); } //if browser version is newer than examples stored in compatbility dictionary //try using the most recent version of gecko driver driverVersion = CompatibilityHelper.GetLatestStoredVersion(BrowserName.Opera); if (!string.IsNullOrWhiteSpace(driverVersion)) { return(driverVersion); } else { throw new ArgumentException("Unable to get 'driverVersion'"); } } catch (Exception ex) { throw ex; } } }