GetSupportedProperties() public method

public GetSupportedProperties ( ) : System.Windows.Automation.AutomationProperty[]
return System.Windows.Automation.AutomationProperty[]
Beispiel #1
0
 public static void LogProperties(AutomationElement element)
 {
     AutomationProperty[] automationProperties = element.GetSupportedProperties();
     foreach (AutomationProperty automationProperty in automationProperties)
     {
         Logger.Info(automationProperty.ProgrammaticName + ":" + element.GetCurrentPropertyValue(automationProperty));
     }
 }
        internal static string GetPatterns(AutomationElement element)
        {
            var properties = element.GetSupportedProperties();

            var msg = new StringBuilder();

            msg.Append("Supported Properties:\n");
            foreach (var automationProperty in properties)
            {
                var value = element.GetCurrentPropertyValue(automationProperty);
                msg.AppendFormat(CultureInfo.InvariantCulture, "{0}: {1}\n", automationProperty.ProgrammaticName, value);
            }

            return msg.ToString();
        }
Beispiel #3
0
 public static void AutomationElementGetSupportedProperties(AutomationElement element)
 {
     Dump("GetSupportedProperties()", true, element);
     try
     {
         AutomationProperty[] obj = element.GetSupportedProperties();
     }
     catch (Exception exception)
     {
         VerifyException(element, exception, typeof(ElementNotAvailableException));
     }
 }
Beispiel #4
0
        private void GetProperties(AutomationElement element, bool recurseChildren, bool recurseFirstSiblings, string level)
        {
            if (element == null)
                return;

            if (element.Current.Name == "Desktop")
                Console.WriteLine("");

            Comment("----------------------------------------------------------------");
            Comment("Path : " + Library.GetUISpyLook(element));
            try
            {
                foreach (AutomationProperty property in element.GetSupportedProperties())
                {
                    try
                    {
                        Comment(level + " : " + property.ToString() + " : " + element.GetCurrentPropertyValue(property));
                    }
                    catch (Exception error)
                    {
                        CacheError(error, property.ToString(), level);
                    }
                }
            }
            catch (Exception error)
            {
                CacheError(error, "GetSupportedProperties", level);
            }

            try
            {
                // Don't do any console windows since it my be ourself and it's output 
                // which will be recursive in output.  I know this might nnot be correct, 
                // as it might be another console window.
                if (element.Current.ClassName != "ConsoleWindowClass")
                    GetProperties(TreeWalker.ControlViewWalker.GetFirstChild(element), recurseChildren, true, level + ".1");
            }
            catch (Exception error)
            {
                CacheError(error, "GetFirstChild", level);
            }

            if (recurseFirstSiblings)
            {

                int iloc = level.LastIndexOf('.');
                if (iloc < 1)
                    return; // we are at the end
                string after = level.Substring(iloc + 1);
                string before = level.Substring(0, iloc);

                int t = Convert.ToInt16(after);
                t++;
                level = before + "." + t.ToString();

                try
                {
                    this.GetProperties(TreeWalker.ControlViewWalker.GetNextSibling(element), recurseFirstSiblings, true, level);
                }
                catch (Exception error)
                {
                    CacheError(error, "GetNextSibling", level);
                }

            }
        }
Beispiel #5
0
		private void SupportedPropertiesTestInternal (AutomationElement element)
		{
			var supportedProperties = element.GetSupportedProperties ();
			foreach (AutomationPattern pattern in element.GetSupportedPatterns ()) {
				foreach (var prop in GetPatternProperties (pattern)) {
					Assert.IsTrue (supportedProperties.Contains (prop),
						string.Format ("[{0}] {1} shall be supported since {2} pattern is supported",
							element.Current.Name,
							prop.ProgrammaticName,
							At.PatternName (pattern)));
				}
			}
			foreach (var prop in supportedProperties) {
				Assert.AreNotEqual (AutomationElement.NotSupported,
					element.GetCurrentPropertyValue (prop, true),
					string.Format ("[{0}] {1} shall be supported since it's in SupportedProperties",
						element.Current.Name,
						prop.ProgrammaticName));
			}
		}