コード例 #1
0
        public void FillInForm(DemoQaUserAddressInfoDto user)
        {
            var FullNameValue = user.GetType().GetRuntimeProperty("FullName").GetValue(user);

            if (FullNameValue != null)
            {
                FullNameFieldTextBox.SendKeys(FullNameValue.ToString());
            }

            var EmailValue = user.GetType().GetRuntimeProperty("Email").GetValue(user);

            if (EmailValue != null)
            {
                EmailFieldTextBox.SendKeys(EmailValue.ToString());
            }

            var CurrentAddressValue = user.GetType().GetRuntimeProperty("CurrentAddress").GetValue(user);

            if (CurrentAddressValue != null)
            {
                CurrentAddressFieldTextBox.SendKeys(CurrentAddressValue.ToString());
            }

            var PermanentAddressValue = user.GetType().GetRuntimeProperty("PermanentAddress").GetValue(user);

            if (PermanentAddressValue != null)
            {
                PermanentAddressFieldTextBox.SendKeys(PermanentAddressValue.ToString());
            }
        }
コード例 #2
0
        //Navigati catre pagina https://demoqa.com/text-box. Completati TOATE campurile si apasati pe butonul de Submit.
        public void DemoQaTextBoxExercise()
        {
            //Arrange
            NavigateToUrl("https://demoqa.com/text-box");

            //Act
            DemoQaTextBoxPage demoQaTextBoxPage = new DemoQaTextBoxPage(Driver);
            var myUser = new DemoQaUserAddressInfoDto
            {
                FullName         = "Test User Full Name",
                Email            = "*****@*****.**",
                CurrentAddress   = "My current street 11, BV, RO",
                PermanentAddress = "My permanent street 13, BV, RO"
            };

            demoQaTextBoxPage.FillInForm(myUser);
            demoQaTextBoxPage.SubmitForm();

            //Assert
            Assert.IsTrue(demoQaTextBoxPage.ConfirmationPanel.Displayed);
        }