/// <summary> /// Returns the parameter associated with the specified parameter name. /// </summary> /// <param name="parameters">The <see cref="Parameters"/> instance that this extension method affects.</param> /// <param name="parameterName">The name of the parameter.</param> /// <returns>The <see cref="Parameter"/> instance associated with <paramref name="parameterName"/>, /// or <c>null</c> if no parameter is found.</returns> public static Parameter TryGetValue(this Parameters parameters, string parameterName) { if (parameters == null) throw new ArgumentNullException(nameof(parameters)); if (string.IsNullOrEmpty(parameterName)) throw new ArgumentException("Argument is null or empty.", nameof(parameterName)); return parameters.ContainsValue(parameterName) ? parameters[parameterName] : null; }
private static string KeyOfValue(this Dictionary<string, string> dictionary, string value) { if (dictionary.ContainsValue(value)) { foreach (string key in dictionary.Keys) { if (dictionary[key] == value) return key; } } return null; }
public static void WaitForValue(this AppiumDriver driver, string elem, string attr, string value, double time = 10) { driver.WaitFor (delegate () {return driver.ContainsValue(elem, attr, value);}, time); }
//扩展方法 private static string KV(this Dictionary<string , string> dict , string v) { if (dict.ContainsValue(v)) { foreach (string key in dict.Keys) { if (dict[key] == v) { return key; } } } return null; }