public void TestPrompt()
        {
            NavigationHelper.NavigateToUrl("http://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt");
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            var text = JavaScriptPopHelper.GetPopUpText();

            JavaScriptPopHelper.SendKeys(text);
            JavaScriptPopHelper.ClickOkOnPopup();
            BrowserHelper.RefreshPage();
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            text = JavaScriptPopHelper.GetPopUpText();
            JavaScriptPopHelper.SendKeys(text + "abc");
            JavaScriptPopHelper.ClickCancelOnPopup();
            ObjectRepository.Driver.SwitchTo().DefaultContent();
            GenericHelper.WaitForWebElement(By.Id("textareaCode"), TimeSpan.FromSeconds(60));
            //TextBoxHelper.ClearTextBox(By.Id("textareaCode"));
            //TextBoxHelper.TypeInTextBox(By.Id("textareaCode"), text);
            //IAlert prompt = ObjectRepository.Driver.SwitchTo().Alert();
            //prompt.SendKeys("This is automation");
            //prompt.Accept();

            // ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            //prompt = ObjectRepository.Driver.SwitchTo().Alert();
            //prompt.SendKeys("This is automation");
            //prompt.Dismiss();
            Logger.Info("Test Prompt Complete");
        }
Ejemplo n.º 2
0
        public void TestConfirmPopup()
        {
            NavigationHelper.NavigateToUrl("https://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm");
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            ButtonHelper.ClickButton(By.CssSelector("body > button:nth-child(2)"));
            Thread.Sleep(2000);
            var text = JavaScriptPopHelper.GetPopUpText();

            JavaScriptPopHelper.ClickOnPopUp();
            Thread.Sleep(2000);
            //IAlert confirm = ObjectRepositiry.Driver.SwitchTo().Alert();
            //confirm.Accept();
            ButtonHelper.ClickButton(By.CssSelector("body > button:nth-child(2)"));
            Thread.Sleep(2000);
            var text2 = JavaScriptPopHelper.GetPopUpText();

            Thread.Sleep(2000);
            JavaScriptPopHelper.ClickCancelOnPopup();
            Thread.Sleep(2000);
            ObjectRepository.Driver.SwitchTo().DefaultContent();
            //IAlert reject = ObjectRepositiry.Driver.SwitchTo().Alert();
            //reject.Dismiss();
            //TextBoxHelper.ClearTextBox(By.CssSelector(".CodeMirror"));
            //TextBoxHelper.TypeInTextBox(By.CssSelector(".CodeMirror"), text);
        }
Ejemplo n.º 3
0
        public void TestConfimPopup()
        {
            NavigationHelper.NavigateToUrl("http://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm");
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            var text = JavaScriptPopHelper.GetPopUpText();

            JavaScriptPopHelper.ClickOkOnPopup();
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            JavaScriptPopHelper.ClickCancelOnPopup();
            ObjectRepository.Driver.SwitchTo().DefaultContent();
            GenericHelper.WaitForWebElement(By.Id("textareaCode"), TimeSpan.FromSeconds(60));
        }
Ejemplo n.º 4
0
        public void TestConfimPopup()
        {
            NavigationHelper.NavigateToUrl("http://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm");
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            var text = JavaScriptPopHelper.GetPopUpText();

            JavaScriptPopHelper.ClickOkOnPopup();
            //IAlert confirm = ObjectRepository.Driver.SwitchTo().Alert();
            //confirm.Accept();
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            JavaScriptPopHelper.ClickCancelOnPopup();
            ObjectRepository.Driver.SwitchTo().DefaultContent();
            TextBoxHelper.ClearTextBox(By.Id("textareaCode"));
            TextBoxHelper.TypeInTextBox(By.Id("textareaCode"), text);
            //confirm = ObjectRepository.Driver.SwitchTo().Alert();
            //confirm.Dismiss();
        }
Ejemplo n.º 5
0
        public void TestPrompt()
        {
            NavigationHelper.NavigateToUrl("https://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt");
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            ButtonHelper.ClickButton(By.CssSelector("body > button:nth-child(2)"));
            //IAlert prompt = ObjectRepositiry.Driver.SwitchTo().Alert();
            JavaScriptPopHelper.sendKeys("This is Automation");
            JavaScriptPopHelper.ClickOnPopUp();
            //prompt.SendKeys("This Is Automation");
            //prompt.Accept();
            Thread.Sleep(2000);

            ButtonHelper.ClickButton(By.CssSelector("body > button:nth-child(2)"));
            JavaScriptPopHelper.sendKeys("This is Automation");
            JavaScriptPopHelper.ClickCancelOnPopup();
            //prompt = ObjectRepositiry.Driver.SwitchTo().Alert();
            //prompt.Dismiss();
            Thread.Sleep(2000);
        }
Ejemplo n.º 6
0
        public void TestConfimPopup()
        {
            NavigationHelper.NavigateToUrl("http://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm");
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            var text = JavaScriptPopHelper.GetPopUpText();

            JavaScriptPopHelper.ClickOkOnPopup();
            //IAlert confirm = ObjectRepository.Driver.SwitchTo().Alert();
            //confirm.Accept();
            ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            JavaScriptPopHelper.ClickCancelOnPopup();
            ObjectRepository.Driver.SwitchTo().DefaultContent();
            GenericHelper.WaitForWebElement(By.Id("textareaCode"), TimeSpan.FromSeconds(60));
            JavaScriptExecutor.ExecuteScript("document.getElementById('textareaCode').style.display='block';");
            TextBoxHelper.ClearTextBox(By.Id("textareaCode"));
            TextBoxHelper.TypeInTextBox(By.Id("textareaCode"), text);
            //confirm = ObjectRepository.Driver.SwitchTo().Alert();
            //confirm.Dismiss();
            Logger.Info("Test Confirm Popup Complete");
        }