Exemple #1
0
        public void CallImage(string path)
        {
            try
            {
                Pattern Image1 = new Pattern(path);
                launch.Start();

                Screen scr = new Screen();
                scr.Click(Image1, true);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
 public void MyTestInitialize()
 {
     _launcher.Start();
     _driver = new ChromeDriver();
     _driver.Manage().Window.Maximize();
     _driver.Navigate().GoToUrl("http://www.xingzuo360.cn/uploads/media/121030/1-1210300F426.swf");
 }
 public void ClassInitialize()
 {
     launcher.Start();
     driver = new InternetExplorerDriver();
     driver.Manage().Window.Maximize();
     driver.Manage().Cookies.DeleteAllCookies();
     driver.Navigate().GoToUrl("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/#identifier");
 }
        public void TestMethod1()
        {
            launcher.Start();

            Thread.Sleep(8000);
            Screen test = new Screen();

            test.DoubleClick(element1);
        }
Exemple #5
0
        public override void Execute()
        {
            if (CheckIfImageValid())
            {
                string      logMessage     = string.Empty;
                APILauncher sikuliLauncher = new APILauncher(out logMessage, ShowSikuliConsole);
                sikuliLauncher.EvtLogMessage += sikuliLauncher_EvtLogMessage;
                sikuliLauncher.Start();

                try
                {
                    Screen sekuliScreen = new Screen();

                    Pattern sikuliPattern = new Pattern(amdocs.ginger.GingerCoreNET.WorkSpace.Instance.Solution.SolutionOperations.ConvertSolutionRelativePath(PatternPath));

                    System.Threading.Tasks.Task.Run(() => SetFocusToSelectedApplicationInstance());

                    switch (ActSikuliOperation)
                    {
                    case eActSikuliOperation.Click:
                        sekuliScreen.Click(sikuliPattern);
                        break;

                    case eActSikuliOperation.SetValue:
                        sekuliScreen.Type(sikuliPattern, SetTextValue);
                        break;

                    case eActSikuliOperation.DoubleClick:
                        sekuliScreen.DoubleClick(sikuliPattern);
                        break;

                    case eActSikuliOperation.MouseRightClick:
                        sekuliScreen.RightClick(sikuliPattern);
                        break;

                    case eActSikuliOperation.Exist:
                        sekuliScreen.Exists(sikuliPattern);
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Reporter.ToLog(eLogLevel.ERROR, ex.Message + Environment.NewLine + ex.Source, ex);
                    Error = string.Format("Error Occured while executing Sikuli Operation {0} : {1}", ActSikuliOperation, ex.Message);
                }
                finally
                {
                    sikuliLauncher.Stop();
                }
            }
        }
        public static void SikuliType(String ImagePath, String text)
        {
            APILauncher Launch = new APILauncher(true);

            Launch.Start();
            Pattern Image = new Pattern(@ImagePath);
            Screen  scr   = new Screen();

            scr.Wait(Image, 5);
            scr.Type(Image, text, KeyModifier.NONE);
            Launch.Stop();
        }
        public static void SikuliClick(String ImagePath)
        {
            APILauncher Launch = new APILauncher(true);
            Pattern     Image  = new Pattern(@ImagePath);

            Launch.Start();
            Screen scr = new Screen();

            scr.Wait(Image, 5);
            scr.Click(Image, true);
            Launch.Stop();
        }
Exemple #8
0
        public static void ClassInitialize(TestContext testContext)
        {
            _launcher = new APILauncher(true);

            _webDriver = new ChromeDriver();

            _launcher.Start();

            _webDriver.Manage().Window.Maximize();

            _webDriver.Navigate().GoToUrl($"{MvpUrl}/{LanguageCode}");
        }
Exemple #9
0
        public static void ClickOnImage(String path)
        {
            APILauncher launcher = new APILauncher(true);

            launcher.Start();
            Screen sc = new Screen();

            Thread.Sleep(2000);
            //Pattern pattern = new Pattern(@"D:\sk\image1.PNG");
            Pattern pattern = new Pattern(path);

            sc.Click(pattern);
            Thread.Sleep(2000);
            launcher.Stop();
        }
Exemple #10
0
        public static void TestSetup()
        {
            _launcher = new APILauncher(false);

            _webDriver = new ChromeDriver();

            ServicePointManager.SecurityProtocol = ( SecurityProtocolType )3072;

            _launcher.VerifyJarExists();

            _launcher.Start();

            _webDriver.Manage().Window.Maximize();

            _webDriver.Navigate().GoToUrl(GoogleUrl);
        }
Exemple #11
0
        static void Main(string[] args)
        {
            //To download JAR files for Sikuli
            APILauncher launcher = new APILauncher(true);

            launcher.Start();

            //Driver definition
            IWebDriver driver = new ChromeDriver();

            //Maximize the driver
            driver.Manage().Window.Maximize();

            //Launch the url
            driver.Navigate().GoToUrl("https://demo.econz.co.nz:1000/AdminPortal/Account/Login/exptest");

            //Screen init
            Screen screen = new Screen();

            //Define Patterns - Username
            Pattern Username = new Pattern(@"C:\Users\Administrator\Documents\Visual Studio 2015\Projects\SikuliDemo\SikuliDemo\Images\Username.JPG");

            //Define Patterns - Username
            Pattern Password = new Pattern(@"C:\Users\Administrator\Documents\Visual Studio 2015\Projects\SikuliDemo\SikuliDemo\Images\Password.JPG");

            //Define Patterns - Username
            Pattern LoginButton = new Pattern(@"C:\Users\Administrator\Documents\Visual Studio 2015\Projects\SikuliDemo\SikuliDemo\Images\LoginButton.JPG");

            //Wait for UN
            screen.Wait(Username);
            //Input UN
            screen.Type(Username, "Jiya");

            //Wait for PWD
            screen.Wait(Password);
            //Input PWD
            screen.Type(Password, "Jiya@345");

            //Wait for LB
            screen.Wait(LoginButton);
            //Click LB
            screen.Click(LoginButton);
        }
Exemple #12
0
        public static void ClickOnCiscoIpPhone(Screen scr, string element)
        {
            try
            {
                //ADD PATH ENV

                APILauncher launcher = new APILauncher();
                launcher.Start();
                Screen  s  = new Screen();
                Pattern ee = new Pattern(@"D:\CiscoIpPhone\ICON_TASKBAR.png");
                s.Click(ee);

                launcher.Stop();

                //scr.Click(new Pattern(CiscoIPCommunicatorImages + element + ".png"), true);
                Thread.Sleep(1000);
            }
            catch (NotFoundException ex)
            {
                Console.WriteLine("Element does NOT exist or click able : " + element);
                Console.WriteLine("Class SikuliCiscoIpPhone | Method ClickOnCiscoIpPhone | Exception desc : " + ex.Message);
            }
        }
        public void GoogleSearchTest()
        {
            launcher.Start();
            GetWebDriver("https://www.google.com/");

            Screen  screen               = new Screen();
            Pattern pattern_SearchText   = new Pattern(@"c:\users\stefani\documents\visual studio 2017\Projects\SeleniumAndSikuli\SeleniumAndSikuli\Images\SearchText.PNG");
            Pattern pattern_SearchButton = new Pattern(@"c:\users\stefani\documents\visual studio 2017\Projects\SeleniumAndSikuli\SeleniumAndSikuli\Images\SearchButton.PNG");
            Pattern pattern_GoogleIcon   = new Pattern(@"c:\users\stefani\documents\visual studio 2017\Projects\SeleniumAndSikuli\SeleniumAndSikuli\Images\Google.PNG");

            screen.Wait(pattern_SearchText, 250);
            screen.Type(pattern_SearchText, "Test", KeyModifier.NONE);
            screen.Wait(pattern_GoogleIcon, 200);
            screen.Click(pattern_GoogleIcon);

            screen.Wait(pattern_SearchButton, 200);
            screen.Click(pattern_SearchButton);

            Thread.Sleep(200);
            webDriver.Quit();

            launcher.Stop();
        }
Exemple #14
0
 public IDesktop()
 {
     launcher = new APILauncher(false);
     launcher.Start();
     //OpenQA.Selenium.IWebDriver driver = new FirefoxDriver(new FirefoxProfile("aqf0u6pa.Dev"));
 }
Exemple #15
0
        public static void RunBeforeAnyTests(TestContext testContext)
        {

            launcher.Start();
        }
Exemple #16
0
        public static void Main()
        {
            APILauncher launcher = new APILauncher(true);

            launcher.Start();

            System.Net.ServicePointManager.Expect100Continue = false;
            Page   page = new Page();
            Screen scr  = new Screen();

            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape))
            {
                Connecton.DeleteUser("delete from Invalid where ID_User=Invalid;");

                try
                {
                    System.Diagnostics.Process.Start(page.ISExe);

                    scr.Wait(page.DB, 100);
                    scr.Type(page.Username, "Invalid");
                    scr.Type(page.Password, "Invalid");
                    scr.Click(page.Login);
                    scr.Wait(page.TabProfireal, 100);
                    scr.Click(page.LoanButton);
                    scr.Click(page.TabLoanButton);

                    Stopwatch swt = new Stopwatch();
                    swt.Start();

                    scr.Type(page.Search, "5006010315" + Key.ENTER);
                    scr.Wait(page.Paid, 100);
                    scr.Click(page.Redaction);
                    scr.Wait(page.Request, 100);

                    swt.Stop();

                    scr.Click(page.RequestExit);
                    scr.Click(page.LoanExit);
                    scr.Click(page.ISExit);
                    scr.Wait(page.WaitQuit, 100);
                    scr.Click(page.Quit);

                    var    time    = swt.Elapsed;
                    string count   = Connecton.GetCountBySql("SELECT COUNT(*) FROM Invalid;");
                    string message = string.Format("{0};{1};{2}", DateTime.Now.ToString(), time.ToString(), count);

                    if (File.Exists(page.LogPath))
                    {
                        SaveLog(page.LogPath, message);
                    }
                    else
                    {
                        using (StreamWriter sw = File.CreateText(page.LogPath))
                        {
                            sw.WriteLine(string.Format("Date;Time;Sessions\n{0}", message));
                        }
                    }

                    if ((int)(time.TotalSeconds) > 45)
                    {
                        string body = string.Format("IS report:{0}", time.ToString());
                        EmailSend(page.LogPath, body);
                    }

                    Wait();
                }
                catch (Exception ex)
                {
                    string body = "Error:" + "\t" + ex.ToString() + "\t" + ex.StackTrace;
                    EmailSend(page.LogPath, body);
                }
            }

            launcher.Stop();
        }
Exemple #17
0
        public void CreateFence()
        {
            luncher.Start();

            GetIWebDriver("https://dev.alexswift.com/Account/Login");

            Screen scr = new Screen();

            //Create a Pattern for "Username" field
            Pattern Username = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\UserName.PNG");

            //Waiting for the pattern to appear
            scr.Wait(Username, 500);
            //SendKeys into Username field
            scr.Type(Username, "*****@*****.**", KeyModifier.NONE);

            //Create a pattern for "Password" field
            Pattern Password = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\Password.PNG");

            //Wait for the pattern to appear
            scr.Wait(Password, 500);
            //SendKeys into Password field
            scr.Type(Password, "Test_123", KeyModifier.NONE);

            //Pattern to click on Login btn
            Pattern LoginBtn = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\LoginBtn.PNG");

            //Wait for Pattern
            scr.Wait(LoginBtn, 500);
            //Click on Login button
            scr.Click(LoginBtn);
            Console.WriteLine("Login successfull");

            //Click on Geofence Hyperlink
            Pattern Geolink = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\GeofenceLink.PNG");

            //Wait for Pattern
            scr.Wait(Geolink, 500);
            //Click on the link
            scr.Click(Geolink);
            Console.WriteLine("Clicked on the Geofence link");

            //Click on AddFence button
            Pattern AddFence = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\AddFence.PNG");

            //Wait for Pattern
            scr.Wait(AddFence, 900);
            scr.RightClick(AddFence);
            //Click on AddFence button
            scr.Click(AddFence);

            ////Click on Search button
            //Pattern SearchBtn = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\SearchBtn.PNG");
            ////Wait for Pattern
            //scr.Wait(SearchBtn, 800);
            ////Click on AddFence button
            //scr.Type(SearchBtn,"Auckland,Newzealand",KeyModifier.NONE);



            //Click on Navigate button to draw a fence
            //wait for pattern
            Pattern Navigate = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\Navigate.PNG");

            scr.Wait(Navigate, 500);
            //Click on Square button
            scr.Click(Navigate);
            // Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Clicked on the Square button");


            //Click on Square button to draw a fence
            Pattern SquareBtn = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\DrawTool.PNG");

            //wait for pattern
            scr.Wait(SquareBtn, 500);
            //Click on Square button
            scr.Click(SquareBtn);

            //Maximise the window
            Pattern Maximise = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\maximise.PNG");

            //wait for pattern
            scr.Wait(Maximise, 500);
            //Click on Square button
            scr.Click(Maximise);

            //Draw a Fence
            Pattern Source = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\Source.PNG");
            //wait for pattern
            //scr.Wait(Source, 500);
            Pattern Destination = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\Destination.PNG");

            //wait for pattern
            //scr.Wait(Destination, 500);

            //Creating Fence by DragDrop operation
            //scr.Exists(Source, 500);
            //Region reg = new Screen();
            //Pattern p = new Pattern("someImage.png");
            //Match m = reg.find(p);
            scr.DragDrop(Source, Destination);

            Pattern minimise = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\minimise.PNG");

            scr.Click(minimise);


            //Click on Save Button
            Pattern SaveBtn = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\SaveBtn.PNG");

            //Wait for the pattern
            scr.Wait(SaveBtn, 500);
            //Click on Save Button
            scr.Click(SaveBtn);

            //Click on confirmation Ok button
            Pattern ConfirmOK = new Pattern(@"C:\Users\chand\Desktop\SikuliTry\SikuliPattens\ConfirmationOK.PNG");

            //Wait for pattern
            scr.Wait(ConfirmOK, 800);
            //Click on OK Button
            scr.Click(ConfirmOK);
            Console.WriteLine("Created the fence successfully");

            driver.Close();

            luncher.Stop();
        }
Exemple #18
0
        public void validarCompra()
        {
            ElementoWebCarroCompra paginaBT = new ElementoWebCarroCompra();

            IJavaScriptExecutor js = PropiedadColeccionDriver.driver as IJavaScriptExecutor;

            APILauncher launcher = new APILauncher(true);

            Screen screen = new Screen();

            Pattern patter_buttoncath = new Pattern("C:/Users/Administrator/Desktop/screen/button.PNG");

            string userName = "******";

            string password = "******";

            string producto = "abrazo";

            string lugar = "Casa";

            string direccion = "Casa #213213 asdasd";

            string region = "(XV) Región de Arica y Parinacota";

            string comuna = "Arica";


            launcher.Start();

            paginaBT.LoginUsuario(userName, password);

            System.Threading.Thread.Sleep(3000);

            paginaBT.IngresarCarroCompra(producto);

            System.Threading.Thread.Sleep(3000);

            js.ExecuteScript("window.scrollBy(0,1000);", "");

            System.Threading.Thread.Sleep(3000);

            screen.Click(patter_buttoncath);

            System.Threading.Thread.Sleep(3000);

            js.ExecuteScript("window.scrollBy(0,-600);", "");

            paginaBT.completarFormulario();

            System.Threading.Thread.Sleep(3000);

            js.ExecuteScript("window.scrollBy(0,600);", "");

            System.Threading.Thread.Sleep(3000);

            paginaBT.completarDirección(lugar, direccion, region, comuna);

            System.Threading.Thread.Sleep(3000);

            PropiedadColeccionDriver.driver.Quit();
        }
Exemple #19
0
        public void Web_Home_Validar_Icono_Carro_Compra()
        {
            ElementoWebHomeBT paginaBT = new ElementoWebHomeBT();

            IJavaScriptExecutor js = PropiedadColeccionDriver.driver as IJavaScriptExecutor;

            APILauncher launcher = new APILauncher(true);

            Screen screen = new Screen();

            Pattern patter_buttoncath = new Pattern("C:/Users/amoreno/Desktop/screen/buttoncath.PNG");

            string lugar = "Casa";

            string direccion = "Casa #213213 asdasd";

            string region = "(XV) Región de Arica y Parinacota";

            string comuna = "Arica";

            System.Threading.Thread.Sleep(6000);

            System.Threading.Thread.Sleep(3000);

            js.ExecuteScript("window.scrollBy(0,650);");

            System.Threading.Thread.Sleep(3000);

            paginaBT.IngresarBotónAgregarCarroProducto();

            System.Threading.Thread.Sleep(3000);

            js.ExecuteScript("window.scrollBy(0,650);");

            System.Threading.Thread.Sleep(3000);

            paginaBT.completarDirección(lugar, direccion, region, comuna);

            System.Threading.Thread.Sleep(3000);

            try
            {
                launcher.Start();

                screen.Click(patter_buttoncath);

                System.Threading.Thread.Sleep(3000);

                paginaBT.IngresarBtnContinuar();

                System.Threading.Thread.Sleep(3000);

                launcher.Stop();
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }


            PropiedadColeccionDriver.driver.Quit();
        }
        public string Chrome_Setup(IWebDriver driver, ILog log, IJavaScriptExecutor executor)
        {
            try
            {
                testname = NUnit.Framework.TestContext.CurrentContext.Test.FullName;

                List <String> lstRecordEvidence = cf.readSysConfigFile("WebPortal", "Evidence", "SysConfig.xml");

                recordEvidence = lstRecordEvidence.ElementAt(1).ToString().ToLower();

                keepScreenShots = lstRecordEvidence.ElementAt(2).ToString().ToLower();

                if (recordEvidence == "yes")
                {
                    job = new ScreenCaptureJob();

                    uf.ScreenCap(job, testname, driver);
                }

                screenHeight = uf.getScreenHeight(driver);

                screenWidth = uf.getScreenWidth(driver);

                log.Info("Screen Height:" + screenHeight + "Screen Width:" + screenWidth + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(300));

                driver.Manage().Window.Position = new System.Drawing.Point(0, 0);

                //driver.Manage().Window.Size = new Size(1600, 900);
                driver.Manage().Window.Size = new Size(screenWidth, screenHeight);

                driver.Manage().Cookies.DeleteAllCookies();

                // This will read the application URL from Config.XML
                username = cf.readingXMLFile("AdminPortal", "Login", "userName", "Config.xml");

                password = cf.readingXMLFile("AdminPortal", "Login", "passWord", "Config.xml");

                appURL = cf.readingXMLFile("AdminPortal", "Login", "startURL", "Config.xml");

                newappURL = "http://" + username + ":" + password + "@" + appURL;

                driver.Navigate().GoToUrl(newappURL);

                globList = cf.readSysConfigFile("Global", "Automation", "SysConfig.xml");

                // This is to check if Sikuli setting is set to 'Yes'

                if (globList.ElementAt(0).ToString().ToLower().Equals("yes"))
                {
                    // This is to check if Sikuli setting is set to 'Yes' then check for sikuli port avaibility and launch sikuli

                    bool sikuliCheck = uf.sikuliPortCheck();

                    Console.WriteLine("Sikuli Check:" + sikuliCheck);

                    log.Info("Sikuli Check:" + sikuliCheck);

                    if (sikuliCheck)
                    {
                        log.Info("Launching Sikuli as sikuli port is available");

                        launcher = new APILauncher(true);

                        launcher.Start();
                    }
                    else
                    {
                        log.Info("Sikuli port is unavailable. Please free the 8080 port in order to start Sikuli");
                    }

                    // This is to check if Sikuli Jetty service is up. Try 90 sec for jetty service to get up

                    bool jettyUpCheck = uf.jettyServiceUpCheck();

                    Console.WriteLine("Jetty Up Check:" + jettyUpCheck);

                    log.Info("Jetty Up Check:" + jettyUpCheck);

                    if (jettyUpCheck)
                    {
                        log.Info("Jetty service is up");
                    }
                    else
                    {
                        log.Info("Jetty service is not running");
                    }

                    Boolean statLogin = au.sikuliAuthLogin("Chrome");

                    log.Info("Login Status:" + statLogin + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());
                }
            }
            catch (Exception e)
            {
                log.Error("Error occurred in Setup" + e.Message + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                Assert.AreEqual(true, false);
            }

            return(newappURL);
        }