public SilverlightDocument(AutomationElement automationElement, BrowserWindow actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { ieWindow = actionListener; }
public WindowSession(ApplicationSession applicationSession, InitializeOption initializeOption) { this.applicationSession = applicationSession; windowItemsMap = WindowItemsMap.Create(initializeOption, RectX.UnlikelyWindowPosition); if (windowItemsMap.LoadedFromFile) initializeOption.NonCached(); this.initializeOption = initializeOption; }
public static WindowItemsMap Create(InitializeOption initializeOption, Point currentWindowPosition) { if (initializeOption.NoIdentification) return new NullWindowItemsMap(); string fileLocation = FileLocation(initializeOption); if (File.Exists(fileLocation)) { Logger.DebugFormat("[PositionBasedSearch] Loading WindowItemsMap for: {0}, from {1}", initializeOption.Identifier, fileLocation); WindowItemsMap windowItemsMap = null; try { using (var fileStream = CreateFileStream(fileLocation)) { windowItemsMap = (WindowItemsMap)CreateDataContractSerializer().ReadObject(fileStream); } } catch (Exception ex) { Logger.DebugFormat("[PositionBasedSearch] Loading WindowItemsMap FAILED for: {0}, Error: {1}", initializeOption.Identifier, ex.Message); Logger.DebugFormat("[PositionBasedSearch] Deleting WindowItemsMap for: {0}", initializeOption.Identifier); try { File.Delete(fileLocation); } catch (IOException) { } } if (windowItemsMap != null) { windowItemsMap.currentWindowPosition = currentWindowPosition; windowItemsMap.loadedFromFile = true; return windowItemsMap; } } Logger.DebugFormat("[PositionBasedSearch] Creating new WindowItemsMap for: {0}", initializeOption.Identifier); return new WindowItemsMap(fileLocation, currentWindowPosition); }
public virtual MainScreen SetUp(InitializeOption initializeOption) { application = new WinformsTestConfiguration().LaunchApplication(); var screenRepository = new ScreenRepository(application.ApplicationSession); mainScreen = screenRepository.Get<MainScreen>("Form1", initializeOption); return mainScreen; }
public virtual MainScreen SetUp(InitializeOption initializeOption) { application = new WinformsTestConfiguration().LaunchApplication(); var screenRepository = new ScreenRepository(application.ApplicationSession); mainScreen = screenRepository.Get<MainScreen>("MainWindow", initializeOption); //mainScreen.Tabs[0].SelectTabPage(2); return mainScreen; }
public virtual WindowSession WindowSession(InitializeOption initializeOption) { if (initializeOption.Identifier == null) return new NullWindowSession(); WindowSession windowSession; if (windowSessions.TryGetValue(initializeOption.Identifier, out windowSession)) return windowSession; windowSession = new WindowSession(this, initializeOption); windowSessions.Add(initializeOption.Identifier, windowSession); return windowSession; }
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> internal static Window Create(AutomationElement element, InitializeOption option, WindowSession windowSession) { SpecializedWindowFactory specializedWindowFactory = SpecializedWindowFactories.Find(factory => factory.DoesSpecializeInThis(element)); if (specializedWindowFactory != null) { return specializedWindowFactory.Create(element, option, windowSession); } var windowsFramework = WindowsFrameworkExtensions.FromFrameworkId(element.Current.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)); }
/// <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); }
protected Window(AutomationElement automationElement, ActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { InitializeWindow(); minOpenTime = Task.Factory.StartNew(() => Thread.Sleep(500)); }
public virtual Window Create(AutomationElement automationElement, InitializeOption initializeOption, WindowSession session) { return new FirefoxWindow(automationElement, WindowFactory.Desktop, initializeOption, session); }
public virtual WindowSession ModalWindowSession(InitializeOption modalInitializeOption) { return applicationSession.WindowSession(modalInitializeOption); }
/// <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 DummyWindow(AutomationElement automationElement, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, initializeOption, windowSession) {}
public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option) { return null; }
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); }
/// <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); }
private Desktop(AutomationElement automationElement, IActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { finder = new AutomationElementFinder(automationElement); }
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 override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option) { throw new NotSupportedException(); }
public override Window ModalWindow(string title, InitializeOption option) { throw new NotSupportedException(); }
public override WindowSession WindowSession(InitializeOption initializeOption) { return new NullWindowSession(); }
public override Window ModalWindow(string title, InitializeOption option) { var childWindow = Get<Window>(SearchCriteria.ByText(title)); return childWindow; }
/// <summary> /// Get the modal window launched by this window. /// </summary> /// <param name="title">Title of the modal window</param> /// <param name="option">Newly created window would be initialized using this option</param> /// <returns></returns> public abstract Window ModalWindow(string title, InitializeOption option);
public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option) { var childWindow = Get<Window>(searchCriteria); return childWindow; }
/// <summary> /// Get the modal window launched by this window. /// </summary> /// <param name="searchCriteria">Search Criteria to use to find a window</param> /// <param name="option">Newly created window would be initialized using this option</param> /// <returns></returns> public abstract Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option);
public override Window ModalWindow(string title, InitializeOption option) { return null; }
public virtual StatusStrip StatusBar(InitializeOption initializeOption) { var statusStrip = (StatusStrip)Get(SearchCriteria.ByControlType(ControlType.StatusBar)); statusStrip.Cached = initializeOption; statusStrip.Associate(WindowSession); return statusStrip; }
/// <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); }
protected Window(AutomationElement automationElement, InitializeOption initializeOption, WindowSession windowSession) : this(automationElement, new NullActionListener(), 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 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); }