private static CruciatusElement OpenChrome(string testPageAddress) { var chromeWindow = new Cruciatus.Application(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"); chromeWindow.Start("--force-renderer-accessibility --start-maximized --app=" + testPageAddress); Thread.Sleep(3000); var chromeFinder = By.Name("Яндекс.Диск").AndType(ControlType.Window); var chrome = Cruciatus.CruciatusFactory.Root.FindElement(chromeFinder); Thread.Sleep(100); #region Login try { while (true) { try { CruciatusElement ce = chrome.FindElementByName("Логин"); while (!ce.Text().Equals("Логин")) { ce.Click(); String backspace = "{BACKSPACE}"; String delete = "{DELETE}"; String clearstr = ""; for (int i = 0; i < ce.Text().Length; i++) { clearstr += backspace + delete; } Cruciatus.CruciatusFactory.Keyboard.SendText(clearstr); } ce.SetText(login); Thread.Sleep(100); break; } catch (Exception) { } } chrome.FindElementByName("Пароль").SetText(password); Thread.Sleep(100); chrome.FindElementByName("Войти ").Click(); Thread.Sleep(3000); } catch (Exception) { Console.WriteLine("Logged"); } #endregion #region Close helpers // Save password? try { chrome.FindElementByName("Нет").Click(); Thread.Sleep(100); } catch (Exception) { } // Install yandex disk on your computer // try { chrome.FindElementByName("Имя ").Click(); Thread.Sleep(100); } catch (Exception) { } #endregion return(chrome); }
private static void OpenExplorerInFolder(string defaultFolder) { Cruciatus.Application expl = new Cruciatus.Application(@"C:\Windows\explorer.exe"); expl.Start(defaultFolder); Thread.Sleep(1000); var winFinder = By.Name("Winium.Desktop.Example").AndType(ControlType.Window); var explorer = Cruciatus.CruciatusFactory.Root.FindElement(winFinder); mouseMove(explorer.FindElementByUid("TitleBar"), 1300, 100); CruciatusElement items = explorer.FindElementByName("Items View"); mouseMove(items.FindElementByName(fileName), 100, 384); Thread.Sleep(1000); explorer.SetFocus(); Thread.Sleep(1000); explorer.FindElementByName("System").DoubleClick(); }