예제 #1
0
 public void setup()
 {
     service = WiniumDriverService.CreateDesktopService(@"C:\oto");
     options = new DesktopOptions {
         ApplicationPath = @"C:\Windows\System32\calc.exe"
     };
     driver = new WiniumDriver(service, options, TimeSpan.FromSeconds(30));
     bsp    = new BasePage(driver);
 }
예제 #2
0
        public BasePage(IWebDriver driver)
        {
            var service = WiniumDriverService.CreateDesktopService(@"C:\oto");
            var options = new DesktopOptions {
                ApplicationPath = @"C:\Windows\System32\calc.exe"
            };

            driver = new WiniumDriver(service, options, TimeSpan.FromMinutes(30));
        }
예제 #3
0
        public void Start()
        {
            DesktopOptions option = new DesktopOptions();

            option.ApplicationPath = (@"c:\windows\system32\calc.exe");
            var service = WiniumDriverService.CreateDesktopService(@"d:\Work\drivers\");

            driver = new WiniumDriver(service, option);
            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(35));
        }
예제 #4
0
        private static void Setup()
        {
            var options = new DesktopOptions();

            options.ApplicationPath = calculatorAppPath;
            options.LaunchDelay     = 1000;
            string winiumDriverPath = AppDomain.CurrentDomain.BaseDirectory + "/Resources";
            var    service          = WiniumDriverService.CreateDesktopService(winiumDriverPath);

            driver = new WiniumDriver(service, options);
        }
예제 #5
0
        private void InitDriver()
        {
            var options = new DesktopOptions()
            {
                ApplicationPath = @"C:\Projects\Altenium\AlteniumWindowsForm\bin\Debug\AlteniumWindowsForm.exe"
            };
            var service = WiniumDriverService
                          .CreateDesktopService(@"C:\Projects\Altenium\packages\Winium.Desktop");

            service.Start();
            _driver = new WiniumDriver(service, options, TimeSpan.FromSeconds(60));
        }
예제 #6
0
        public void AutomateNotePad()
        {
            DesktopOptions option = new DesktopOptions {
                ApplicationPath = "C:\\Windows\\System32\\notepad.exe"
            };
            WiniumDriverService service = WiniumDriverService.CreateDesktopService(@"D:\WorkSpace\WinAppDriver"); //We can have both application and winium driver inside the project
            WiniumDriver        driver  = new WiniumDriver(service, option);

            Thread.Sleep(10000);
            driver.FindElement(By.ClassName("Notepad")).FindElement(By.ClassName("Edit")).SendKeys("Welcome to Winium Automation");
            driver.Quit();
        }
        public void GivenQueACalculadoraEstejaAberta()
        {
            CloseCalc();
            DesktopOptions options = new DesktopOptions {
                ApplicationPath = @"C:\Windows\System32\Calc.exe"
            };
            var service = WiniumDriverService.CreateDesktopService(@"C:\Winium\");

            service.Start();
            driver = new WiniumDriver(service, options, TimeSpan.FromSeconds(60));
            Thread.Sleep(10);
        }
예제 #8
0
        public static void LoadApp(TestContext context)
        {
            //var service = WiniumDriverService.CreateDesktopService(@"C:\Users\bom4e\Downloads\Winium.Desktop.Driver");
            var service = WiniumDriverService.CreateDesktopService(@"C:\Users\HungDang\Downloads\Winium.Desktop.Driver");


            DesktopOptions option = new DesktopOptions
            {
                ApplicationPath = PosAppId
            };

            driver = new WiniumDriver(service, option, TimeSpan.FromSeconds(60));
        }
예제 #9
0
        private static void Setup()
        {
            var options = new DesktopOptions();

            options.ApplicationPath = calculatorAppPath;

            string winiumDriverPath = Directory.GetParent(
                Directory.GetParent(Directory.GetParent(Directory.GetParent(
                                                            AppDomain.CurrentDomain.BaseDirectory).ToString()).ToString()).ToString()).ToString() + "/Resources";

            var service = WiniumDriverService.CreateDesktopService(winiumDriverPath);

            driver = new WiniumDriver(service, options);
        }
예제 #10
0
        public void AutomateCalculator()
        {
            DesktopOptions option = new DesktopOptions {
                ApplicationPath = "C:\\Windows\\System32\\calc.exe"
            };
            WiniumDriverService service = WiniumDriverService.CreateDesktopService(@"D:\WorkSpace\WinAppDriver");
            WiniumDriver        driver  = new WiniumDriver(service, option);

            Thread.Sleep(10000);
            IWebElement mainwindow        = driver.FindElement(By.ClassName("ApplicationFrameWindow"));
            IWebElement NumberPad         = mainwindow.FindElement(By.ClassName("LandmarkTarget")).FindElement(By.Id("NumberPad"));
            IWebElement StandardOperators = mainwindow.FindElement(By.ClassName("LandmarkTarget")).FindElement(By.Id("StandardOperators"));

            NumberPad.FindElement(By.Id("num8Button")).Click();
            NumberPad.FindElement(By.Id("num7Button")).Click();
            NumberPad.FindElement(By.Id("num9Button")).Click();
            StandardOperators.FindElement(By.Id("plusButton")).Click();
            NumberPad.FindElement(By.Id("num9Button")).Click();
            NumberPad.FindElement(By.Id("num7Button")).Click(); //97
            StandardOperators.FindElement(By.Id("equalButton")).Click();
            driver.Quit();
        }
예제 #11
0
        public void TestMethod1()
        {
            try
            {
                string winiumdriverlink = @"C:\Users\pramo_gsxqos1\Downloads\Winium.Desktop.Driver";
                string inspectpath      = @"C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64";

                var service = WiniumDriverService.CreateDesktopService(winiumdriverlink);

                var controlPanel     = "control.exe";
                var notepad          = "notepad.exe";
                var internetexplorer = "iexplore.exe";

                var notepadLocation  = @"C:\Windows\System32\notepad.exe";
                var controlLocation  = LocateEXE(controlPanel);
                var iexploreLocation = @"C:\Program Files (x86)\Internet Explorer\iexplore.exe";


                var controlPanelOptions = new DesktopOptions {
                    ApplicationPath = controlLocation
                };
                var notepadOptions = new DesktopOptions {
                    ApplicationPath = notepadLocation
                };
                var iexploreOptions = new DesktopOptions {
                    ApplicationPath = iexploreLocation
                };



                WiniumDriver windriver = new WiniumDriver(service, iexploreOptions, TimeSpan.FromSeconds(60));
                //WiniumDriver windriver2 = new WiniumDriver(service, notepadOptions, TimeSpan.FromSeconds(60));
                string parent = windriver.CurrentWindowHandle;
                Thread.Sleep(1000);
                windriver.FindElementByName("Tools").Click();
                Thread.Sleep(1000);
                String child = windriver.CurrentWindowHandle;
                windriver.FindElementByName("Internet options").Click();
                Thread.Sleep(1000);
                windriver.FindElementByName("Advanced").Click();
                Thread.Sleep(1000);
                var iseabled = windriver.FindElementByName("Reset...").GetAttribute("IsEnabled");
                Thread.Sleep(1000);
                //windriver.FindElementByName("Reset...").Click();
                //Thread.Sleep(1000);
                windriver.FindElementByName("Close").Click();

                WiniumDriver windriver2 = new WiniumDriver(service, notepadOptions, TimeSpan.FromSeconds(60));
                Thread.Sleep(1000);
                windriver2.FindElementByClassName("Edit").SendKeys("isEnabled:-   " + iseabled);

                #region timout
                //WiniumDriver windriver = new WiniumDriver(service, controlPanelOptions, TimeSpan.FromSeconds(60));
                //Thread.Sleep(1000);

                //string parent = windriver.CurrentWindowHandle;

                //windriver.FindElementByClassName("SearchEditBox").SendKeys("change screen saver");
                //Thread.Sleep(1000);


                //windriver.FindElementById("tasklink").Click();
                //Thread.Sleep(1000);

                //string child = windriver.CurrentWindowHandle;

                //IWebElement window = windriver.FindElementByClassName("#32770");
                //Thread.Sleep(1000);
                ////windriver.FindElementByClassName("#32770");

                ////String child  = windriver.CurrentWindowHandle;

                //windriver.SwitchTo().Window(parent);
                //Thread.Sleep(1000);
                //windriver.FindElementByName("Close").Click();
                //Thread.Sleep(1000);
                //windriver.SwitchTo().Window(child);
                //Thread.Sleep(1000);
                //// IWebElement scwindow = windriver.FindElementByClassName("#32770");

                //var scwindow = windriver.FindElementByName("Screen Saver Settings");
                //var scwindow2 = scwindow.FindElement(By.Name("Screen Saver"));

                //var list = scwindow2.FindElements(By.XPath(".//*"));

                //Thread.Sleep(2000);
                //var x = "";
                //for (int i = 0; i < list.Count; i++)
                //{
                //    var xx = list[i].GetAttribute("AutomationId");
                //    var xxx = list[i].GetAttribute("Name");

                //    if (xx == "1307")
                //    {
                //        x = x + list[i].GetAttribute("IsEnabled");

                //    }

                //}
                ////var x = scwindow.FindElement(By.ClassName("Edit")).TagName;
                //Thread.Sleep(2000);

                //WiniumDriver windriver2 = new WiniumDriver(service, notepadOptions, TimeSpan.FromSeconds(60));
                //windriver2.FindElementByClassName("Edit").SendKeys("TimeoutEnabled:-   " + x);
                #endregion
            }
            catch (Exception ex)
            {
                var xs = ex.StackTrace;
            }
        }