Exemple #1
0
        public void SetInputValue(AddressInputs input, string value)
        {
            var addressForm = Container.GetElementWaitByCSS(AddressForm.locator);

            switch (input)
            {
            case AddressInputs.Country:
                var countryInput = addressForm.GetElementWaitByCSS(CountrySelector.locator);
                countryInput.webElement.Click();
                var options = countryInput.GetElementsWaitByCSS(CountryOptionItems.locator);
                var option  = options.FirstOrDefault(el => el.webElement.Text.Contains(value));
                option.webElement.Click();
                break;

            case AddressInputs.CompanyName:
                var companyNameField = addressForm.GetElementWaitByCSS(CompanyNameInput.locator);
                companyNameField.webElement.Clear();
                companyNameField.webElement.SendKeys(value);
                break;

            case AddressInputs.State:
                var stateField = addressForm.GetElementWaitByCSS(stateSelect.locator);
                stateField.webElement.Clear();
                stateField.webElement.SendKeys(value);
                break;

            case AddressInputs.City:
                var cityField = addressForm.GetElementWaitByCSS(cityInput.locator);
                cityField.webElement.Clear();
                cityField.webElement.SendKeys(value);
                break;

            case AddressInputs.Street:
                var streetField = addressForm.GetElementWaitByCSS(streetSelectDropdownlist.locator);
                streetField.webElement.Clear();
                streetField.webElement.SendKeys(value);
                break;

            case AddressInputs.Postal:
                var postalField = addressForm.GetElementWaitByCSS(postalInput.locator);
                postalField.webElement.Clear();
                postalField.webElement.SendKeys(value);
                break;

            case AddressInputs.Apartment:
                var apartmentField = addressForm.GetElementWaitByCSS(aptNumberInput.locator);
                if (!string.IsNullOrEmpty(value))
                {
                    apartmentField.webElement.Clear();
                    apartmentField.webElement.SendKeys(value);
                }
                break;

            default: throw new ArgumentException($"{input} is not supported");
            }
        }
Exemple #2
0
        public string GetBillingAddressInputValue(AddressInputs input)
        {
            DomElement formContainer           = DetailSection.GetElementWaitByCSS(DetailSectionCardTokenForm.locator);
            DomElement billingAddressContainer = formContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressForm.locator);
            string     value = string.Empty;

            switch (input)
            {
            case AddressInputs.CompanyName:
                var companyNameInput = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormCompanyName.locator);
                value = companyNameInput.webElement.GetAttribute("value");
                break;

            case AddressInputs.Country:
                var countrySelector = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormCountrySelector.locator);
                var countryValue    = countrySelector.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormCountrySelectedLabel.locator);
                value = countryValue.webElement.Text;
                break;

            case AddressInputs.Street:
                var street = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormStreet.locator);
                value = street.webElement.GetAttribute("value");
                break;

            case AddressInputs.Apartment:
                var apartment = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormApartment.locator);
                value = apartment.webElement.GetAttribute("value");
                break;

            case AddressInputs.City:
                var city = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormCity.locator);
                value = city.webElement.GetAttribute("value");
                break;

            case AddressInputs.State:
                var state = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormState.locator);
                value = state.webElement.GetAttribute("value");
                break;

            case AddressInputs.Postal:
                var postal = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormPostal.locator);
                value = postal.webElement.GetAttribute("value");
                break;

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

            return(value);
        }
Exemple #3
0
        public void SetInputAddressValue(AddressInputs input, string value)
        {
            DomElement formContainer           = DetailSection.GetElementWaitByCSS(DetailSectionCardTokenForm.locator);
            DomElement billingAddressContainer = formContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressForm.locator);

            switch (input)
            {
            case AddressInputs.CompanyName:
                var addressInput = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormCompanyName.locator);
                SetInputValue(addressInput, value);
                break;

            case AddressInputs.Country:
                var countrySelector = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormCountrySelector.locator);
                countrySelector.webElement.Click();

                var options = countrySelector.GetElementsWaitByCSS(ItemSelectorContainerBillingAddressFormCountryOptionItems.locator);
                var option  = options.FirstOrDefault(el => el.webElement.Text.Contains(value));
                option.webElement.Click();
                break;

            case AddressInputs.Street:
                var street = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormStreet.locator);
                SetInputValue(street, value);
                break;

            case AddressInputs.Apartment:
                var apartment = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormApartment.locator);
                SetInputValue(apartment, value);
                break;

            case AddressInputs.City:
                var city = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormCity.locator);
                SetInputValue(city, value);
                break;

            case AddressInputs.State:
                var state = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormState.locator);
                SetInputValue(state, value);
                break;

            case AddressInputs.Postal:
                var postal = billingAddressContainer.GetElementWaitByCSS(ItemSelectorContainerBillingAddressFormPostal.locator);
                SetInputValue(postal, value);
                break;
            }
        }
Exemple #4
0
        public virtual void SetAddressElement(AddressInputs field, string text)
        {
            switch (field)
            {
            case AddressInputs.Apt:
                SetAddressInput(detailShippingEditFormInputNewApt, text);
                break;

            case AddressInputs.ATTN:
                SetAddressInput(detailShippingEditFormInputNewATTN, text);
                break;

            case AddressInputs.City:
                SetAddressInput(detailShippingEditFormInputNewCity, text);
                break;

            case AddressInputs.Country:
                SetAddressDropDown(detailShippingEditFormInputNewCountryDropdown, text);
                break;

            case AddressInputs.Postal:
                SetAddressInput(detailShippingEditFormInputNewZip, text);
                break;

            case AddressInputs.Region:
                SetAddressInput(detailShippingEditFormInputNewRegion, text);
                break;

            case AddressInputs.State:
                SetAddressDropDown(detailShippingEditFormInputNewStateDropdown, text);
                break;

            case AddressInputs.StreetAddress:
                SetAddressInput(detailShippingEditFormInputNewStreet, text);
                break;
            }
        }