Ejemplo n.º 1
0
        public void SmokeTestofPage()
        {
            string radio = "Corporate Relations";

            IWebElement button = ContactUs.GetRadioByLabel(driver, radio);

            button.Click();

            string header    = "First Name";
            string firstName = "Peter";

            IWebElement firstNameTextBox = ContactUs.GetTextboxByHeader(driver, header);

            firstNameTextBox.SendKeys(firstName);

            header = "Last Name";
            string lastName = "Parker";

            IWebElement lastNameTextBox = ContactUs.GetTextboxByHeader(driver, header);

            lastNameTextBox.SendKeys(lastName);

            header = "Email";
            string email = "*****@*****.**";

            IWebElement emailTextBox = ContactUs.GetTextboxByHeader(driver, header);

            emailTextBox.SendKeys(email);

            string checkbox = "Include me in future mailings";

            IWebElement box = ContactUs.GetCheckboxbyLabel(driver, checkbox);

            box.Click();

            header = "Phone (Optional)";
            string phone = "(123)456-7890";

            IWebElement phoneTextBox = ContactUs.GetTextboxByHeader(driver, header);

            phoneTextBox.SendKeys(phone);

            string message = "Please stop hating on spidey, hes trying his best.";

            IWebElement messageTextBox = ContactUs.GetMessageTextbox(driver);

            messageTextBox.SendKeys(message);

            IWebElement submit = ContactUs.GetSubmitButton(driver);

            submit.Click();

            try
            {
                IWebElement confirm = Submission.GetConfirmation(driver);
            }
            catch (NoSuchElementException e)
            {
                Assert.Fail($"The confirmation element and text was not on the page and therefore the submission was not successful. {e.Message}");
            }
        }