public static void FilterByPriceRange(FilterPage page, int?minPrice, int?maxPrice)
        {
            string url = page.GetDriver().Url;

            SetPrice(page, minPrice, maxPrice).SubmitPriceFilter();
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
        }
        public static FilterPage ClickCheckbox(FilterPage page, string name)
        {
            string url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.MoreIzdButton);
            if (!ConstantCollectionsExtensions.RussianLetters.Contains(name[0]))
            {
                for (int i = 0; i < page.CheckboxIzdSet.Count; i++)
                {
                    if (page.CheckboxIzdSet[i].GetText().IndexOf(name + " (") == 0)
                    {
                        if (page.CheckboxIzdSet[i].GetText().Equals(name + " (0)"))
                        {
                            throw new Exception("No products with such filtering parameters.");
                        }
                        page.CheckboxIzdSet[i].Click();
                        break;
                    }
                }
            }
            else
            {
                int j = page.CheckboxIzdSet.Count;
                int i = 0;
                while (page.CheckboxIzdSet[i].GetText()[0] != name[0])
                {
                    if (name[0] < page.CheckboxIzdSet[j / 2].GetText()[0])
                    {
                        j = (j - i) / 2;
                    }
                    else
                    {
                        i = i + (j - i) / 2;
                    }
                }
                int k = i - 1;
                while (page.CheckboxIzdSet[k].GetText()[0] == name[0] && page.CheckboxIzdSet[k].GetText().IndexOf(name + " (") != 0)
                {
                    k--;
                }
                if (page.CheckboxIzdSet[k].GetText().IndexOf(name + " (") != 0)
                {
                    k = i + 1;
                    while (page.CheckboxIzdSet[k].GetText()[0] == name[0] && page.CheckboxIzdSet[k].GetText().IndexOf(name + " (") != 0)
                    {
                        k++;
                    }
                }

                if (page.CheckboxIzdSet[k].GetText().Equals(name + " (0)"))
                {
                    throw new Exception("No products with such filtering parameters.");
                }
                page.CheckboxIzdSet[k].Click();
            }
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
            return(page);
        }
Exemple #3
0
        public static void BuyElement(FilterPage page, int elementIndex)
        {
            var url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.BuyButtonSet[elementIndex]);
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
        }
        public static void ClickContinuePurchases(CartPageWithOrders page)
        {
            var url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.ProceedBuying);
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
        }
        public static FilterPage ClickCheckbox(FilterPage page, string name, int howlongIcnwait)
        {
            string url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.MoreIzdButton, howlongIcnwait);
            int i = SerchStandurt(page, name);

            if (i == -1)
            {
                throw new Exception("No products with such filtering parameters.");
            }
            page.Publishing[i].Click();
            WaitingExtensions.WaitUntilUrlIsChanged(page, url, howlongIcnwait);
            return(page);
        }