public override Window ModalWindow(string title, InitializeOption option) { WindowFactory desktopWindowsFactory = WindowFactory.Desktop; return(desktopWindowsFactory.FindModalWindow(title, Process.GetProcessById(automationElement.Current.ProcessId), option, automationElement, WindowSession.ModalWindowSession(option))); }
/// <summary> /// Initializes a new instance of the <see cref="Window"/> class. /// </summary> /// <param name="automationElement"> /// The automation element. /// </param> /// <param name="initializeOption"> /// The initialize option. /// </param> /// <param name="windowSession"> /// The window session. /// </param> protected Window( AutomationElement automationElement, InitializeOption initializeOption, WindowSession windowSession) : this(automationElement, new NullActionListener(), initializeOption, windowSession) { }
public UIItemContainer(AutomationElement automationElement, ActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener) { WindowSession = windowSession; CurrentContainerItemFactory = new CurrentContainerItemFactory(factory, initializeOption, automationElement, ChildrenActionListener); }
/// <summary> /// Get the MessageBox window launched by this window /// </summary> /// <param name="title">Title of the messagebox</param> /// <returns></returns> public virtual Window MessageBox(string title) { Window window = factory.ModalWindow(title, InitializeOption.NoCache, WindowSession.ModalWindowSession(InitializeOption.NoCache)); window.actionListener = this; return(window); }
public SilverlightDocument(AutomationElement automationElement, BrowserWindow actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { ieWindow = actionListener; }
public virtual Window ModalWindow(string title, InitializeOption option, WindowSession windowSession) { var message = "Could not find modal window with title: " + title; var modalWindowElement = WaitTillFound(() => Finder.FindWindow(title, 0), message); return(Create(modalWindowElement, option, windowSession)); }
public virtual Window ModalWindow(string title, InitializeOption option, WindowSession windowSession) { var message = "Could not find modal window with title: " + title; title = title.Replace("&", string.Empty); // Seems v3 just strips the amperstand out var modalWindowElement = WaitTillFound(() => Finder.FindWindow(title, 0), message); return(Create(modalWindowElement, option, windowSession)); }
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> public virtual Window FindModalWindow(string title, Process process, InitializeOption option, AutomationElement parentWindowElement, WindowSession windowSession) { var windowFinder = new AutomationElementFinder(parentWindowElement); var message = "Could not find modal window with title: " + title; var modalWindowElement = WaitTillFound(() => FindModalWindowElement(title, process, windowFinder), message); return(Create(modalWindowElement, option, windowSession)); }
private Window ModalWindow(Clock.Do find, InitializeOption option, WindowSession windowSession) { var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout); Clock.Matched matched = obj => obj != null; Clock.Expired expired = () => null; var automationElement = (AutomationElement)clock.Perform(find, matched, expired); return(automationElement == null ? null: Create(automationElement, option, windowSession)); }
private void InitializeWindow() { ActionPerformed(); Rect bounds = Desktop.Instance.Bounds; if (!bounds.Contains(Bounds) && (TitleBar != null && TitleBar.MinimizeButton != null)) { Logger.WarnFormat( @"Window with title: {0} whose dimensions are: {1}, is not contained completely on the desktop {2}. UI actions on window needing mouse would not work in area not falling under the desktop", Title, Bounds, bounds); } WindowSession.Register(this); }
/// <summary> /// Recursively gets all the descendant windows. /// </summary> /// <returns></returns> public virtual List <Window> ModalWindows() { var modalWindows = new List <Window>(); var finder = new AutomationElementFinder(automationElement); var descendants = finder.Descendants(AutomationSearchCondition.ByControlType(ControlType.Window)); foreach (AutomationElement descendant in descendants) { modalWindows.Add(ChildWindowFactory.Create(descendant, InitializeOption.NoCache, WindowSession.ModalWindowSession(InitializeOption.NoCache))); } return(modalWindows); }
private void InitializeWindow() { ActionPerformed(); Rect bounds = Desktop.Instance.Bounds; if (!bounds.Contains(Bounds) && (TitleBar != null && TitleBar.MinimizeButton != null)) { Logger.WarnFormat( @"Window with title: {0} whose dimensions are: {1}, is not contained completely on the desktop {2}. UI actions on window needing mouse would not work in area not falling under the desktop", Title, Bounds, bounds); } WindowSession.Register(this); var hwnd = new IntPtr(automationElement.Current.NativeWindowHandle); int ownerProcessId; ownerThreadId = NativeWindow.GetWindowThreadProcessId(hwnd, out ownerProcessId); ownerProcess = Process.GetProcessById(ownerProcessId); }
public virtual Window FindModalWindow(string title, Process process, InitializeOption option, AutomationElement parentWindowElement, WindowSession windowSession) { var windowFinder = new AutomationElementFinder(parentWindowElement); try { AutomationElement modalWindowElement = WaitTillFound(delegate { AutomationElement windowElement = windowFinder.FindWindow(title, process.Id) ?? Finder.FindWindow(title, process.Id); return(windowElement); }, "Could not find modal window with title: " + title); return(Create(modalWindowElement, option, windowSession)); } catch (UIActionException e) { logger.Debug(e.ToString()); return(null); } }
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> public virtual Window FindWindow(Process process, Predicate <string> match, InitializeOption initializeOption, WindowSession windowSession) { string message = string.Format("Could not find window matching condition. ProcessName: {0}, ProcessId: {1}, MatchingConditionMethod: {2}, MatchingConditionTarget: {3}", process.ProcessName, process.Id, match.Method, match.Target); var foundElement = WaitTillFound(() => FindWindowElement(process, match), message); return(Create(foundElement, initializeOption, windowSession)); }
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> public virtual Window CreateWindow(SearchCriteria searchCriteria, Process process, InitializeOption option, WindowSession windowSession) { var message = string.Format("Couldn't find window with SearchCriteria {0} in process {1}{2}", searchCriteria, process.Id, Constants.BusyMessage); var element = WaitTillFound(() => Finder.FindWindow(searchCriteria, process.Id), message); return(Create(element, option, windowSession)); }
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> public virtual Window CreateWindow(string title, Process process, InitializeOption option, WindowSession windowSession) { var message = string.Format("Couldn't find window with title {0} in process {1}{2}", title, process.Id, ", after waiting for 30 seconds"); var element = WaitTillFound(() => Finder.FindWindow(title, process.Id), message); return(Create(element, option, windowSession)); }
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> public virtual Window FindModalWindow(SearchCriteria searchCriteria, InitializeOption option, AutomationElement parentWindowElement, WindowSession windowSession) { var windowFinder = new AutomationElementFinder(parentWindowElement); var message = "Could not find modal window with SearchCriteria: " + searchCriteria; var modalWindowElement = WaitTillFound(() => FindModalWindowElement(searchCriteria, windowFinder), message); return(Create(modalWindowElement, option, windowSession)); }
public Firefox(AutomationElement automationElement, WindowFactory windowFactory, InitializeOption option, WindowSession windowSession) : base(automationElement, windowFactory, option, windowSession) { }
public virtual Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option, WindowSession windowSession) { var message = "Could not find modal window with SearchCriteria: " + searchCriteria; var modalWindowElement = WaitTillFound(() => Finder.FindWindow(searchCriteria), message); return(Create(modalWindowElement, option, windowSession)); }
public override Window ModalWindow(string title, InitializeOption option) { return(factory.ModalWindow(title, option, WindowSession.ModalWindowSession(option))); }
internal WinFormWindow(AutomationElement automationElement, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, initializeOption, windowSession) { }
public virtual Window FindModalWindow(SearchCriteria searchCriteria, InitializeOption option, AutomationElement parentWindowElement, WindowSession windowSession) { var windowFinder = new AutomationElementFinder(parentWindowElement); try { AutomationElement modalWindowElement = WaitTillFound(delegate { AutomationElement windowElement = windowFinder.FindWindow(searchCriteria) ?? Finder.FindWindow(searchCriteria); return(windowElement); }, "Could not find modal window with SearchCriteria: " + searchCriteria); return(Create(modalWindowElement, option, windowSession)); } catch (UIActionException e) { logger.Debug(e.ToString()); return(null); } }
/// <summary> /// Recursively gets all the descendant windows. /// </summary> /// <returns></returns> /// <exception cref="UIItemSearchException">The application type is not supported by White</exception> // from ChildWindowFactory.Create public virtual List <Window> ModalWindows() { var finder = new AutomationElementFinder(automationElement); var descendants = finder.Descendants(AutomationSearchCondition.ByControlType(ControlType.Window)); return(descendants .Select(descendant => ChildWindowFactory.Create(descendant, InitializeOption.NoCache, WindowSession.ModalWindowSession(InitializeOption.NoCache))) .ToList()); }
protected Window(AutomationElement automationElement, ActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { InitializeWindow(); minOpenTime = Task.Factory.StartNew(() => Thread.Sleep(500)); }
//TODO Try and get this working //public override List<Window> ModalWindows() //{ // var automationSearchConditions = new AutomationSearchConditionFactory() // .GetWindowSearchConditions(automationElement.Current.ProcessId) // .ToArray(); // var descendants = new AutomationElementFinder(automationElement) // .Children(automationSearchConditions); // return descendants // .Select(descendant => ChildWindowFactory.Create(descendant, InitializeOption.NoCache, WindowSession.ModalWindowSession(InitializeOption.NoCache))) // .ToList(); //} public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option) { return(windowFactory.ModalWindow(searchCriteria, option, WindowSession.ModalWindowSession(option))); }
public Win32Window(AutomationElement automationElement, WindowFactory windowFactory, InitializeOption option, WindowSession windowSession) : base(automationElement, option, windowSession) { this.windowFactory = windowFactory; }
public override List <Window> ModalWindows() { var descendants = new AutomationElementFinder(automationElement) .Children(new AutomationSearchConditionFactory().GetWindowSearchConditions(automationElement.Current.ProcessId).ToArray()); return(descendants .Select(descendant => ChildWindowFactory.Create(descendant, InitializeOption.NoCache, WindowSession.ModalWindowSession(InitializeOption.NoCache))) .ToList()); }
private Desktop(AutomationElement automationElement, ActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { finder = new AutomationElementFinder(automationElement); }
public virtual Window Create(AutomationElement automationElement, InitializeOption initializeOption, WindowSession session) { return new Firefox(automationElement, WindowFactory.Desktop, initializeOption, session); }
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> internal static Window Create(AutomationElement element, InitializeOption option, WindowSession windowSession) { ISpecializedWindowFactory specializedWindowFactory = SpecializedWindowFactories.Find(factory => factory.DoesSpecializeInThis(element)); if (specializedWindowFactory != null) { return(specializedWindowFactory.Create(element, option, windowSession)); } var windowsFramework = WindowsFrameworkExtensions.FromFrameworkId(element.Properties.FrameworkId); if (windowsFramework == WindowsFramework.WinForms) { return(new WinFormWindow(element, option, windowSession)); } if (windowsFramework == WindowsFramework.Wpf) { return(new WPFWindow(element, WindowFactory.Desktop, option, windowSession)); } if (windowsFramework == WindowsFramework.Win32) { return(new Win32Window(element, WindowFactory.Desktop, option, windowSession)); } throw new UIItemSearchException(string.Format("{0} is not supported yet.", windowsFramework)); }
public virtual IUIItem Find(SearchCriteria searchCriteria, WindowSession windowSession) { return(windowSession.Get(current, searchCriteria, actionListener)); }