Exemplo n.º 1
0
        public void SetUpTest()
        {
            String servName = ConfigurationManager.ConnectionStrings["Server"].ConnectionString;
            String appName  = ConfigurationManager.ConnectionStrings["AUT"].ConnectionString;

            //Start the Winium desktop driver
            String winiumDriver = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDi‌​rectory, "..\\..\\Common\\executables\\Winium.Desktop.Driver.exe"));

            //Debug.WriteLine(">>>>>>>>>>>> " + winiumDriver);
            ExecStart = Process.Start(winiumDriver);

            //Setup capabilities and invoke the application
            //got a error 20122017:
            //OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL
            // http://localhost:9999/session/AwesomeSession/element timed out after 60 seconds.
            //var dc = new DesiredCapabilities();
            //dc.SetCapability("app", @appName);
            //driver = new RemoteWebDriver(new Uri(servName), dc);

            DesktopOptions options = new DesktopOptions();

            options.ApplicationPath = appName;
            DesiredCapabilities dc = (DesiredCapabilities)options.ToCapabilities();

            driver = new RemoteWebDriver(new Uri(servName), dc);
        }
Exemplo n.º 2
0
        public void ClearingLastNumberTest_Calc004()
        {
            System.Threading.Thread.Sleep(10000);
            //arrange
            DesktopOptions options = new DesktopOptions();

            options.ApplicationPath = @"C:\Users\Компьютер\source\repos\Citizen\Citizen\bin\Debug\Citizen.exe";
            WiniumDriver driver = new WiniumDriver(@"D:\instal\Winium.Desktop.Driver", options);
            String       actualResult;
            String       expectedResult = "25";

            System.Threading.Thread.Sleep(1000);
            try
            {
                // act
                driver.FindElementByName("2").Click();
                driver.FindElementByName("5").Click();
                driver.FindElementByName("7").Click();
                driver.FindElementByName("<-").Click();
                actualResult = driver.FindElementById("textBox").Text;
                System.Threading.Thread.Sleep(1000);

                //assert
                Assert.AreEqual(expectedResult, actualResult);
            }
            catch
            {
                Console.WriteLine("Test Calc004 fallen.");
            }
            finally
            {
                System.Threading.Thread.Sleep(1000);
                driver.Close();
            }
        }
Exemplo n.º 3
0
        public void ClearingFieldTest_Calc003()
        {
            System.Threading.Thread.Sleep(10000);
            //arrange
            DesktopOptions options = new DesktopOptions();

            options.ApplicationPath = @"C:\Users\Компьютер\source\repos\Citizen\Citizen\bin\Debug\Citizen.exe";
            WiniumDriver driver = new WiniumDriver(@"D:\instal\Winium.Desktop.Driver", options);
            String       actualResult;
            String       expectedResult = "0";

            System.Threading.Thread.Sleep(1000);

            // act
            driver.FindElementByName("2").Click();
            driver.FindElementByName("5").Click();
            driver.FindElementByName("7").Click();
            driver.FindElementByName("CE").Click();
            actualResult = driver.FindElementById("textBox").Text;
            System.Threading.Thread.Sleep(1000);

            //assert
            Assert.AreEqual(expectedResult, actualResult);

            driver.Close();
        }
Exemplo n.º 4
0
        public SeleniumTest()
        {
            DesktopOptions options = new DesktopOptions();
            string         path    = System.IO.Path.GetDirectoryName(typeof(Form1).Assembly.Location);

            options.ApplicationPath = path + @"\BazaDanychKlientów.exe";
            driver = new WiniumDriver(@"C:\Users\Krystian\Documents\GitHub\bazaklientow", options);
        }
Exemplo n.º 5
0
        public WiniumTest()
        {
            DesktopOptions options = new DesktopOptions();
            string         path    = System.IO.Path.GetDirectoryName(typeof(Form1).Assembly.Location);

            options.ApplicationPath = path + @"\MagazynCzesciSamochodowych.exe";
            driver = new WiniumDriver(@"C:\Users\Krawczuk\Desktop\MagazynCzesciSamochodowych\MagazynCzesciSamochodowych", options);
        }
Exemplo n.º 6
0
        public WiniumDriver AbrirDriver(string caminhoapp, string caminhodriver)
        {
            option = new DesktopOptions();
            option.ApplicationPath = caminhoapp;

            driver = new WiniumDriver(caminhodriver, option, TimeSpan.FromSeconds(360));
            return(driver);
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
0
        public void TestNotePad()
        {
            DesktopOptions options = new DesktopOptions();

            options.ApplicationPath = @"C:\Windows\notepad.exe";
            WiniumDriver driver = new WiniumDriver(@"C:\Users\Eletronica10\source\repos\UnitTestProject1\UnitTestProject1", options);//Winium.Desktop.Driver.exe

            driver.FindElementByClassName("Edit").SendKeys("hello world");
        }
Exemplo n.º 9
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);
 }
Exemplo n.º 10
0
        public void WriteHelloWorldOnNotepad()
        {
            DesktopOptions options = new DesktopOptions();

            options.ApplicationPath = @"C:\Windows\System32\notepad.exe";                   //link to nodepad.exe path

            WiniumDriver driver = new WiniumDriver(@"C:\Users\Ch4initus\Desktop", options); //define a new WiniumDriver, first param link to WiniumDesktopDriver downloaded before

            driver.FindElementByClassName("Edit").SendKeys("Hello World!!!");               //open inspect.exe in Window Kits to get the Classname of notepad, SendKeys is used for writing in notepad
        }
Exemplo n.º 11
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));
        }
Exemplo n.º 12
0
        private void button2_Click(object sender, EventArgs e)
        {
            var options = new DesktopOptions();

            options.ApplicationPath = @"C:\Windows\System32\notepad.exe";
            //Winium.Desktop.Driver.exeの場所指定
            WiniumDriver driver = new WiniumDriver(@"C:\dev\svn\trunk\Trash\Trash\011Winium.Cruciatus試し\Winium.Desktop.Driver", options);

            driver.FindElementByClassName("Edit").SendKeys("Hello World.");
        }
Exemplo n.º 13
0
        private void button1_Click(object sender, EventArgs e)
        {
            var options = new DesktopOptions();

            options.ApplicationPath = @"C:\Windows\System32\notepad.exe";
            //Winium.Desktop.Driver.exeの場所指定
            WiniumDriver driver = new WiniumDriver(@"C:\dev\svn\trunk\meeting\meeting\WiniumSampleProject\WiniumSampleProject\bin\Debug", options);

            //driver.FindElementByClassName("Edit").SendKeys("Hello World.");
            driver.FindElementById("15").SendKeys("aiueo");
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
        public UserMethods()
        {
            DesktopOptions options = new DesktopOptions {
                ApplicationPath = ConfigurationManager.AppSettings.Get("IntactPath")
            };

            driver = new WiniumDriver(ConfigurationManager.AppSettings.Get("DriverPath"), options);

            //driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(double.Parse(ConfigurationManager.AppSettings.Get("ImplicitWait"))));
            action = new Actions(driver);
            m      = new WiniumMethods(driver);
        }
Exemplo n.º 16
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();
        }
Exemplo n.º 17
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));
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        /**Doesn't work
         * This is going to connect to a remote server with the name brought in by serverName, when used
         * Doesn't work with the changes that have been made, lots of these are readonly
         */
        private void ConnectToRemoteDesktop(DesktopOptions options, string serverName)
        {
            //method = MethodBase.GetCurrentMethod().Name;
            //Print(method, "Started");

            //options.ApplicationPath = ConfigurationManager.AppSettings.Get("RemoteDesktop");
            //driver = new WiniumDriver(driverPath, options);
            //m.sendKeysByName("Remote Desktop Connection", serverName);
            //m.clickByName("Connect");

            //print(method, "Finished");
        }
Exemplo n.º 20
0
        public void Initialize()
        {
            //var dc = new DesiredCapabilities();
            //dc.SetCapability("app", @"C:/windows/system32/calc.exe");
            //driver = new RemoteWebDriver(new Uri("http://*****:*****@"C:/windows/system32/calc.exe";
            options.LaunchDelay     = 2;

            driver = new WiniumDriver(@"C:/temp/", options); //C:/temp/Winium.Desktop.Driver.exe
            Thread.Sleep(1000);
        }
Exemplo n.º 21
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));
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
0
        public void TestMethod1()
        {
            DesktopOptions option = new DesktopOptions();

            option.ApplicationPath = (@"C:\Users\Ch4initus\Desktop\Test\HelloWorld.exe");

            WiniumDriver driver = new WiniumDriver(@"C:\Users\Ch4initus\Desktop", option);

            driver.FindElementByClassName("WindowsForms10.EDIT.app.0.2bf8098_r13_ad1").SendKeys("Hoàng Quốc Trung 1512609");

            driver.FindElementByClassName("WindowsForms10.BUTTON.app.0.2bf8098_r13_ad1").Click();

            driver.Quit();
        }
Exemplo n.º 24
0
        public void LaunchNotepadAndWriteSomething()
        {
            DesktopOptions options = new DesktopOptions
            {
                ApplicationPath = (@"C:\Windows\System32\notepad.exe")
            };

            // cuidado neste ponto nao pode ser incluido o nome do arquivo do winium
            WiniumDriver driver = new WiniumDriver(@"C:\Users\User01\Downloads", options);

            Thread.Sleep(2000);
            driver.FindElementByClassName("Edit").SendKeys("Eliza");
            Thread.Sleep(2000);
            driver.FindElementByName("File").Click();
            Thread.Sleep(2000);
            driver.FindElementById("Close").Click();
            Thread.Sleep(2000);
            driver.FindElementByName("Don't Save").Click();
        }
Exemplo n.º 25
0
        public void TestMethod1()
        {
            //abrir a calculadora
            DesktopOptions option = new DesktopOptions();

            option.ApplicationPath = "C:\\Windows\\system32\\calc.exe";

            driver = new WiniumDriver("Driver", option);

            //clicar nos botões indicados, os encontrando pelo nome
            driver.FindElement(By.Name("Sete")).Click();
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Mais")).Click();
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Dois")).Click();
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Igual a")).Click();
            TakeScreenshot(" ");
        }
Exemplo n.º 26
0
        public void TestInitialize()
        {
            var options = new DesktopOptions();

            options.ApplicationPath = TargetAppPath;
            driver = new WiniumDriver(WiniumDriverPath, options);

            window   = driver.FindElementByClassName("CalcFrame");
            key0     = window.FindElement(By.Name("0"));
            key1     = window.FindElement(By.Name("1"));
            key2     = window.FindElement(By.Name("2"));
            key3     = window.FindElement(By.Name("3"));
            key4     = window.FindElement(By.Name("4"));
            key5     = window.FindElement(By.Name("5"));
            key6     = window.FindElement(By.Name("6"));
            key7     = window.FindElement(By.Name("7"));
            key8     = window.FindElement(By.Name("8"));
            key9     = window.FindElement(By.Name("9"));
            keyAdd   = window.FindElement(By.Name("加算"));
            keyEqual = window.FindElement(By.Name("等号"));
        }
Exemplo n.º 27
0
        public void TestMethod1()
        {
            DesktopOptions options = new DesktopOptions();

            options.ApplicationPath = "C:\\Windows\\System32\\notepad.exe";

            WiniumDriver driver = new WiniumDriver(@"F:\ARB\GitHub\csharppractice\specflow\automate_win_app\winium\Winium.Desktop.Driver", options);

            driver.FindElementByName("Безымянный – Блокнот");
            driver.Keyboard.PressKey(OpenQA.Selenium.Keys.Alt);
            Thread.Sleep(500);
            driver.Keyboard.SendKeys("Ф");// RUS keyboard should be turned on
            Thread.Sleep(500);
            driver.Keyboard.ReleaseKey(OpenQA.Selenium.Keys.Alt);
            Thread.Sleep(500);
            driver.Keyboard.SendKeys(OpenQA.Selenium.Keys.Escape);
            driver.Keyboard.SendKeys(OpenQA.Selenium.Keys.Escape);
            driver.FindElementByClassName("Edit").SendKeys("Hello winium!");
            Thread.Sleep(500);
            driver.FindElementById("Close").Click();
            driver.FindElementById("CommandButton_7").Click();
        }
Exemplo n.º 28
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();
        }
Exemplo n.º 29
0
        public void TestMethod2()
        {
            //abrir a calculadora
            DesktopOptions option = new DesktopOptions();

            option.ApplicationPath = "C:\\Windows\\system32\\notepad.exe";

            driver = new WiniumDriver("Driver", option);

            //clicar nos botões indicados, os encontrando pelo nome
            driver.FindElement(By.Name("Editor de Texto")).SendKeys("Emelyne Riechter");
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Arquivo")).Click();
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Salvar")).Click();
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Codificação:")).SendKeys("teste");
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Documentos")).Click();
            TakeScreenshot(" ");
            driver.FindElement(By.Name("Salvar")).Click();
            TakeScreenshot(" ");
        }
Exemplo n.º 30
0
        public void TestMethod()
        {
            var option = new DesktopOptions
            {
                ApplicationPath = @"C:\Windows\System32\calc.exe"
            };

            Thread.Sleep(2000);
            var driver = new WiniumDriver(new Uri("http://localhost:9999"), option);

            Thread.Sleep(2000);
            Assert.IsNotNull(driver);
            // TODO: Add your test code here
            Thread.Sleep(1450);
            driver.FindElement(By.Name("Sept")).Click();
            Thread.Sleep(450);
            driver.FindElement(By.Id("plusButton")).Click();
            Thread.Sleep(450);
            driver.FindElement(By.Name("Huit")).Click();
            Thread.Sleep(450);
            driver.FindElement(By.Name("Est égal à")).Click();
            Thread.Sleep(450);
        }