/// <summary> /// This function returns htmlDocument for a given window. /// </summary> /// <param name="hwnd">Handle pointer to the window (main frame).</param> /// <param name="uiPropertyKey">Desired UI property key.</param> /// <param name="uiPropertyValue">Desired UI property value.</param> /// <param name="specialCond">The thread will keep on looping till the desired condition is attained</param> /// <returns>Html document.</returns> public HtmlDocument Get_HtmlDocumentToWindow(IntPtr hwnd, string uiPropertyKey, string uiPropertyValue, object specialCond) { try { this.hwndWizard = hwnd; do { ////Get the window object UIObject objWindow = UIObject.FromHandle(this.hwndWizard); ////Get the Internet Explorer_Server object UIObject objIE_Server = objWindow.Descendants.Find(UIProperty.Get(uiPropertyKey), uiPropertyValue); Window winIE_Server = new Window(objIE_Server.NativeWindowHandle); //// Get HTML Document this.htmlDocWizzrd = new HtmlDocument(winIE_Server); }while ((bool)specialCond); } catch (Exception e) { throw e; } return(this.htmlDocWizzrd); }
/// <summary> /// This function returns htmlDocument for a given window. /// </summary> /// <param name="hwnd">Handle pointer to the window (main frame).</param> /// <param name="uiPropertyKey">Desired UI property key.</param> /// <param name="uiPropertyValue">Desired UI property value.</param> /// <param name="elementToFind">The thread will keep on looping till the desired element is found in the return html.</param> /// <param name="isSpecific">If the function is for specific code.</param> /// <returns>Html document.</returns> public HtmlDocument Get_HtmlDocumentToWindow(IntPtr hwnd, string uiPropertyKey, string uiPropertyValue, string elementToFind, bool isSpecific) { try { int count = 0; this.hwndWizard = hwnd; do { ////Get the window object UIObject objWindow = UIObject.FromHandle(this.hwndWizard); ////Get the Internet Explorer_Server object UIObject objIE_Server = objWindow.Descendants.Find(UIProperty.Get(uiPropertyKey), uiPropertyValue); Window winIE_Server = new Window(objIE_Server.NativeWindowHandle); //// Get HTML Document this.htmlDocWizzrd = new HtmlDocument(winIE_Server); count++; }while ((!this.htmlDocWizzrd.RawHtml.ToString().Contains(elementToFind)) && (count < 5)); } catch (Exception e) { throw e; } return(this.htmlDocWizzrd); }
public HtmlDocument Get_HtmlDocumentToWindow1(IntPtr hwnd, string uiPropertyKey, string uiPropertyValue) { try { this.hwndWizard = hwnd; ////Get the window object(Main window). UIObject objWindow = UIObject.FromHandle(this.hwndWizard); ////Get the specific UI object. UIObject objIE_Server = objWindow.Descendants.Find(UIProperty.Get(uiPropertyKey), uiPropertyValue); ////Create window to the specific UI object. Window winIE_Server = new Window(objIE_Server.NativeWindowHandle); //// Get HTML Document(Main window). this.htmlDocWizzrd = new HtmlDocument(winIE_Server); } catch (Exception e) { } return(this.htmlDocWizzrd); }
public Window Get_HtmlDocumentToWindow(IntPtr hid, string abc, string xyz) { try { this.hwd = hid; ////Get the window object UIObject objWindow = UIObject.FromHandle(this.hwd); ////Get the Internet Explorer_Server object UIObject objIE_Server = objWindow.Descendants.Find(UIProperty.Get(abc), xyz); winIE_Server = new Window(objIE_Server.NativeWindowHandle); // doc = new HtmlDocument(winIE_Server); } catch (Exception ex) { throw ex; } return(winIE_Server); }
/// <summary> /// This function returns htmlDocument for a given window, it searches 5 times(project requirement). /// </summary> /// <param name="hwnd">Handle pointer to the window (main frame).</param> /// <param name="uiPropertyKey">Desired UI property key.</param> /// <param name="uiPropertyValue">Desired UI property value.</param> /// <param name="elementToFind">The thread will keep on looping till the desired element is found in the return html.</param> /// <param name="isSpecific">If the function is for specific code.</param> /// <returns>Html document.</returns> public HtmlDocument Get_HtmlDocumentToWindow(IntPtr hwnd, string uiPropertyKey, string uiPropertyValue, string elementToFind, bool isSpecific) { try { int count = 0; this.hwndWizard = hwnd; do { ////Get the window object(Main window). UIObject objWindow = UIObject.FromHandle(this.hwndWizard); ////Get the specific UI object. UIObject objIE_Server = objWindow.Descendants.Find(UIProperty.Get(uiPropertyKey), uiPropertyValue); ////Create window to the specific UI object. Window winIE_Server = new Window(objIE_Server.NativeWindowHandle); //// Get HTML Document(Main window). this.htmlDocWizzrd = new HtmlDocument(winIE_Server); count++; }while ((!this.htmlDocWizzrd.RawHtml.ToString().Contains(elementToFind)) && (count < 5)); } catch (Exception e) { #if debug throw new MitabaseException(MitaBaseMessages.HtmlDocNotFetch + Environment.NewLine + e.Message + Environment.NewLine + "UIElementWindow."); #endif throw new MitabaseException(MitaBaseMessages.HtmlDocNotFetch); } return(this.htmlDocWizzrd); }
/// <summary> /// This method is used when exact UI property to a control is known. /// </summary> /// <param name="hwnd">Handle pointer to the window (main frame).</param> /// <param name="uiPropertyKey">Desired UI property key.</param> /// <param name="uiPropertyValue">Desired UI property value.</param> /// <returns>Control window.</returns> public Window Get_WindowToSpecificControl(IntPtr hwnd, string uiPropertyKey, string uiPropertyValue) { try { this.hwndWizard = hwnd; ////Get the window object(Main window). UIObject objSignupWindow = UIObject.FromHandle(this.hwndWizard); ////Get the specific UI object. UIObject objIE_Server = objSignupWindow.Descendants.Find(UIProperty.Get(uiPropertyKey), uiPropertyValue); ////Create window to the specific UI object. this.winControl = new Window(objIE_Server.NativeWindowHandle); } catch (Exception e) { #if debug throw new MitabaseException(MitaBaseMessages.CreateWindowFail + Environment.NewLine + e.Message + Environment.NewLine + "UIElementWindow."); #endif throw new MitabaseException(MitaBaseMessages.CreateWindowFail); } return(this.winControl); }
/// <summary> /// This method is used when exact UI property to a control is known. /// </summary> /// <param name="hwnd">Handle pointer to the window (main frame).</param> /// <param name="uiPropertyKey">Desired UI property key.</param> /// <param name="uiPropertyValue">Desired UI property value.</param> /// <returns>Control window.</returns> public Window Get_WindowToSpecificControl(IntPtr hwnd, string uiPropertyKey, string uiPropertyValue) { try { this.hwndWizard = hwnd; UIObject objSignupWindow = UIObject.FromHandle(this.hwndWizard); UIObject objIE_Server = objSignupWindow.Descendants.Find(UIProperty.Get(uiPropertyKey), uiPropertyValue); this.winControl = new Window(objIE_Server.NativeWindowHandle); } catch (Exception e) { throw e; } return(this.winControl); }