public string TakeScreenShotsOfMenu(string folder, string name)
        {
            Logger.Info(CultureInfo.CurrentCulture, "Take Screen Shots");
            var el = this.Driver.GetElement(this.menu);

            return(TakeScreenShot.TakeScreenShotOfElement(el, folder, name));
        }
        public void RegisterUser()
        {
            DemoQaHome hm = new DemoQaHome(driver);

            hm.registration.Click();
            ExplicitElementWait.ElementIsVisible(By.TagName("h1"));
            RegistrationPage register = new RegistrationPage(driver);

            //register.EnterFullName("Vamsi Krishna", "Gattupalli");
            //register.marital_Status("single");
            //register.check_hobby("reading");
            //register.Select_country("India");
            //register.selectDateofBirth("6", "17", "1992");
            //register.EnterPhoneNumber("2818189636");
            //register.EnterUserName("vkrishna92");
            //register.EnterEmailID("*****@*****.**");
            //register.EnterAboutYourSelf("abc");
            //register.EnterPassword("123");
            //register.ConfirmPassword("123");
            //((IJavaScriptExecutor)driver).ExecuteScript(
            //"arguments[0].scrollIntoView();", register.firstName);
            //register.profilePicUpload.Click();
            register.uploadFile(@"C:\Users\vkris\Desktop\SampleReport.txt");
            TakeScreenShot.takeScreenshot();
            Thread.Sleep(5000);
        }
        public void SaveFullScreenShotTest()
        {
            var downloadPage     = new InternetPage(this.DriverContext).OpenHomePage().GoToFileDownloader();
            var screenShotNumber = FilesHelper.CountFiles(this.DriverContext.ScreenShotFolder, FileType.Png);

            TakeScreenShot.Save(TakeScreenShot.DoIt(), ImageFormat.Png, this.DriverContext.ScreenShotFolder, this.DriverContext.TestTitle);
            var nameOfScreenShot = downloadPage.CheckIfScreenShotIsSaved(screenShotNumber);

            Assert.IsTrue(nameOfScreenShot.Contains(this.DriverContext.TestTitle), "Name of screenshot doesn't contain Test Title");
        }
        public string TakeScreenShotsOfTextInIFrame(string folder, string name)
        {
            Logger.Info(CultureInfo.CurrentCulture, "Take Screen Shots");
            var iFrame = this.Driver.GetElement(this.iframe);
            int x      = iFrame.Location.X;
            int y      = iFrame.Location.Y;

            this.Driver.SwitchTo().Frame(0);
            var el = this.Driver.GetElement(this.elelemtInIFrame);

            return(TakeScreenShot.TakeScreenShotOfElement(x, y, el, folder, name));
        }
Example #5
0
        /// <summary>
        /// Takes and saves screen shot
        /// </summary>
        public void TakeAndSaveScreenshot()
        {
            if (BaseConfiguration.FullDesktopScreenShotEnabled)
            {
                TakeScreenShot.Save(TakeScreenShot.DoIt(), ImageFormat.Png, this.ScreenShotFolder, this.TestTitle);
            }

            if (BaseConfiguration.SeleniumScreenShotEnabled)
            {
                this.SaveScreenshot(new ErrorDetail(this.TakeScreenshot(), DateTime.Now, null), this.ScreenShotFolder, this.TestTitle);
            }
        }
Example #6
0
        /// <summary>
        /// Takes a screenshot from the browser and saves the image in specified path
        /// </summary>
        public void Take_ScreenShot(string instance, string filepath)
        {
            var browser = BrowserManager.Instance.GetBrowserInstance(instance);
            var command = new TakeScreenShot();
            var param   = new CommandParams()
            {
                Application = browser, InputData = filepath
            };
            var timeout = browser.CommandTimeout;

            RetryCommandInvoker.Invoke <bool>(command.Execute, param, timeout);
        }
        public void SaveFullScreenShotTest()
        {
            var downloadPage     = new InternetPage(this.DriverContext).OpenHomePage().GoToFileDownloader();
            var screenShotNumber = FilesHelper.CountFiles(this.DriverContext.ScreenShotFolder, FileType.Png);

            Assert.IsNotNull(TakeScreenShot.Save(TakeScreenShot.DoIt(), ImageFormat.Png, this.DriverContext.ScreenShotFolder, string.Format(CultureInfo.CurrentCulture, this.DriverContext.TestTitle + "_first")));
            var nameOfScreenShot = downloadPage.CheckIfScreenShotIsSaved(screenShotNumber);

            TestContext.AddTestAttachment(nameOfScreenShot);
            Assert.IsTrue(nameOfScreenShot.Contains(this.DriverContext.TestTitle), "Name of screenshot doesn't contain Test Title");
            Assert.IsNotNull(this.DriverContext.TakeAndSaveScreenshot());
        }
Example #8
0
        public void TakeScreenShotMapView()
        {
            if (TestContext.CurrentContext.Result.Outcome != ResultState.Success)
            {
                TakeScreenShot takeScreenShot = new TakeScreenShot();
                takeScreenShot.GetRegularScreenShot(driver);
            }

            else
            {
            }
        }
Example #9
0
        /// <summary>
        /// Takes and saves screen shot
        /// </summary>
        /// <returns>Array of filepaths</returns>
        public string[] TakeAndSaveScreenshot()
        {
            List <string> filePaths = new List <string>();

            if (BaseConfiguration.FullDesktopScreenShotEnabled)
            {
                filePaths.Add(TakeScreenShot.DoIt(this.NgDriver, this.ScreenShotFolder, this.TestTitle));
            }

            if (BaseConfiguration.SeleniumScreenShotEnabled)
            {
                filePaths.Add(this.SaveScreenshot(new ErrorDetail(this.TakeScreenshot(), DateTime.Now, null), this.ScreenShotFolder, this.TestTitle));
            }

            return(filePaths.ToArray());
        }
Example #10
0
        public string TakeScreenShotsOfTextInIFrame(string folder, string name)
        {
            Logger.Info(CultureInfo.CurrentCulture, "Take Screen Shots");
            var iFrame = this.Driver.GetElement(this.iframe);
            int x      = iFrame.Location.X;
            int y      = iFrame.Location.Y;

            this.Driver.SwitchTo().Frame(0);
            var el = this.Driver.GetElement(this.elelemtInIFrame);

#if net47
            return(TakeScreenShot.TakeScreenShotOfElement(x, y, el, folder, name));
#endif
#if netcoreapp2_2
            return("to_be_implemented_in_netcore");
#endif
        }
Example #11
0
        /// <summary>
        /// Takes and saves screen shot.
        /// </summary>
        /// <returns>Array of filepaths.</returns>
        public string[] TakeAndSaveScreenshot()
        {
            List <string> filePaths = new List <string>();

            if (BaseConfiguration.FullDesktopScreenShotEnabled)
            {
                // to do TakeScreenShot
#if net47
                filePaths.Add(TakeScreenShot.Save(TakeScreenShot.DoIt(), ImageFormat.Png, this.ScreenShotFolder, this.TestTitle));
#endif
            }

            if (BaseConfiguration.SeleniumScreenShotEnabled)
            {
                filePaths.Add(this.SaveScreenshot(new ErrorDetail(this.TakeScreenshot(), DateTime.Now, null), this.ScreenShotFolder, this.TestTitle));
            }

            return(filePaths.ToArray());
        }
Example #12
0
        protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
        {
            exception   = "";
            returnValue = CefV8Value.CreateUndefined();

            if (name == EndEncounterFunctionName)
            {
                EndEncounter?.Invoke(obj, new EndEncounterEventArgs());
            }
            else if (name == TakeScreenShotFunctionName)
            {
                if (arguments.Length > 0)
                {
                    TakeScreenShot?.Invoke(obj, new TakeScreenShotEventArgs(arguments[0].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }
            else if (name == BroadcastMessageFunctionName)
            {
                if (arguments.Length > 0)
                {
                    BroadcastMessage?.Invoke(obj, new BroadcastMessageEventArgs(arguments[0].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }
            else if (name == SendMessageFunctionName)
            {
                if (arguments.Length > 1)
                {
                    SendMessage?.Invoke(obj, new SendMessageEventArgs(arguments[0].GetStringValue(), arguments[1].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }
            else if (name == OverlayMessageFunctionName)
            {
                if (arguments.Length > 1)
                {
                    OverlayMessage?.Invoke(obj, new SendMessageEventArgs(arguments[0].GetStringValue(), arguments[1].GetStringValue()));
                }
                else
                {
                    exception = "Invalid argument count.";
                }

                return(true);
            }

            return(false);
        }
Example #13
0
 private void Awake()
 {
     instance = this;
     myCamera = GetComponent <Camera>();
 }