public static string GetNameExp(IElement element) { string elementType = element.GetType().ToString(). Replace("GUI_Testing_Automation.", ""). Replace("Element", ""); //Debug.WriteLine(elementType); return(element.Attributes.DesignedName != "" ? (elementType + " " + GUI_Utils.NormalizeString(element.Attributes.DesignedName)) : (elementType + " " + GUI_Utils.NormalizeString(element.Attributes.DesignedId))); }
/// <summary> /// store capture image to folder @path2FolderStore /// @fileName = @ElementType_@ElementName_@ddMMyy_HHmmss /// </summary> /// <param name="path2FolderStore"></param> /// <returns></returns> public bool Capture(string path2FolderStore) { string fileName = this.Attributes.ElementType + "_"; fileName += this.Attributes.DesignedName != "" ? GUI_Utils.NormalizeString(this.Attributes.DesignedName) : GUI_Utils.NormalizeString(this.Attributes.DesignedId); fileName += "_" + System.DateTime.Now.ToString("ddMMyy_HHmmss") + ".png"; string filePath = path2FolderStore + @"\" + fileName; //modified by @duongtd - 09/11 //hard code string encoded = CaptureElement.CaptureScreen( GetCurrentAutoElement().Current.BoundingRectangle, filePath); return(encoded != null); }