Example #1
0
        public void FillInputText(ContactInfoFields input, string text)
        {
            DomElement contactInfoField        = null;
            var        contactSectionContainer = Container.GetElementWaitByCSS(ContactInfoContainer.locator);
            var        editContactForm         = contactSectionContainer.GetElementWaitByCSS(Form.locator);

            switch (input)
            {
            case ContactInfoFields.FirstName:
                contactInfoField = editContactForm.GetElementWaitByCSS(FirstNameField.locator);
                break;

            case ContactInfoFields.LastName:
                contactInfoField = editContactForm.GetElementWaitByCSS(LastNameField.locator);
                break;

            case ContactInfoFields.PhoneNumber:
                contactInfoField = editContactForm.GetElementWaitByCSS(PhoneNumberField.locator);
                break;

            case ContactInfoFields.EmailAddress:
                contactInfoField = editContactForm.GetElementWaitByCSS(EmailAddressField.locator);
                break;

            default: throw new Exception($"{input} is not supported yet...");
            }

            contactInfoField.webElement.Clear();
            contactInfoField.webElement.SendKeys(text);
        }
Example #2
0
        public string GetContactFieldText(ContactInfoFields field)
        {
            string fieldText = string.Empty;

            var contactSummary = Container.GetElementWaitByCSS(DetailSection.locator).GetElementWaitByCSS(ContactSummaryContainer.locator);

            switch (field)
            {
            case ContactInfoFields.FirstName:
                fieldText = contactSummary.GetElementWaitByCSS(FirstNameSpan.locator).webElement.Text;
                break;

            case ContactInfoFields.LastName:
                fieldText = contactSummary.GetElementWaitByCSS(LastNameSpan.locator).webElement.Text;
                break;

            case ContactInfoFields.Company:
                fieldText = contactSummary.GetElementWaitByCSS(CompanyNameSpan.locator).webElement.Text;
                break;

            case ContactInfoFields.PhoneNumber:
                fieldText = contactSummary.GetElementWaitByCSS(PhoneNumberSpan.locator).webElement.Text;
                break;

            case ContactInfoFields.EmailAddress:
                fieldText = contactSummary.GetElementWaitByCSS(EmailAddressSpan.locator).webElement.Text;
                break;

            default:
                throw new Exception($"{field} is not supported yet");
            }

            return(fieldText);
        }
Example #3
0
        public string GetErrorMessageFromInput(ContactInfoFields input)
        {
            var        contactContainer = Container.GetElementWaitByCSS(ContactInfoContainer.locator);
            var        contactForm      = contactContainer.GetElementWaitByCSS(Form.locator);
            DomElement inputMessage     = null;

            switch (input)
            {
            case ContactInfoFields.FirstName:
                inputMessage = contactForm.GetElementWaitByCSS(FirstNameErrorMessage.locator);
                break;

            case ContactInfoFields.LastName:
                inputMessage = contactForm.GetElementWaitByCSS(LastNameErrorMessage.locator);
                break;

            case ContactInfoFields.PhoneNumber:
                inputMessage = contactForm.GetElementWaitByCSS(PhoneNumberErrorMessage.locator);
                break;

            case ContactInfoFields.EmailAddress:
                inputMessage = contactForm.GetElementWaitByCSS(EmailAddressErrorMessage.locator);
                break;

            default:
                throw new ArgumentException($"{input} is not supported");
            }

            return(inputMessage.webElement.Text);
        }