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; } } }
public string GetDriverVersion(string browserVersion) { try { // look at dictionary and get latest version stored //PhantomJS has no more active development (as of March 2019) so simply return last version from dictionary return(CompatibilityHelper.GetLatestStoredVersion(BrowserName.PhantomJS)); } catch (Exception ex) { throw new ArgumentException("Unable to get 'driverVersion'", ex.InnerException); } }
/// <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); } }
/// <summary> /// Gets the latest version. /// </summary> /// <returns></returns> public virtual string GetDriverVersion(string browserVersion) { try { try { using (var client = new WebClient()) { var xmlhtml = client.DownloadString(_seleniumDriverListURL); var versionXml = new XmlDocument(); versionXml.LoadXml(xmlhtml); //using xpath to find only contents with 'IEDriverServer' string XmlNodeList xPathIEDriverNodeList = versionXml.SelectNodes("//*[contains(text(), 'IEDriverServer_Win32')]/.."); // Find the most recent version number based on Modifed date string mostRecentVersion = GetMostRecentVersionNumber(xPathIEDriverNodeList); return(mostRecentVersion); } } catch { //Add Logging } //if code has reached this point then online lookup was unsuccessful /// look at dictoinary and get latest version stored CompatibilityHelper.Initialise(BrowserName.InternetExplorer); var latestStoredVersion = CompatibilityHelper.GetLatestStoredVersion(BrowserName.InternetExplorer); return(latestStoredVersion); } 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; } } }