Esempio n. 1
0
        public void AddToCartElementByIndex(int index)
        {
            List <DomElement> items = catalogSummary.GetElementsWaitByCSS(displayedButtonItems.locator);

            if (index > items.Count - 1 || index < 0)
            {
                index = items.Count - 1;
            }
            base.ScrollToTop();
            //this do while repeats the click if the page doesn't get selenium's click
            do
            {
                try
                {
                    Thread.Sleep(1000);
                    items[index].webElement.Click();
                }
                catch (Exception)
                {
                    Thread.Sleep(1000);
                    items = catalogSummary.GetElementsWaitByCSS(displayedButtonItems.locator);
                    items[index].webElement.Click();
                }
                DomElement miniCart = catalogSummary.GetElementWaitUntilByXpath(this.miniCart.locator, (el) => el.Displayed);
            } while (miniCart.webElement != null);
            //this line waits until mini cart is no longer visible
            catalogSummary.GetElementWaitUntilByXpath(this.miniCart.locator, (el) => el.Displayed == false);
            //*********
        }
Esempio n. 2
0
        public void ClickOnAddToList()
        {
            DomElement addToListButton = offeringSummary.GetElementWaitByCSS(this.addToListButton.locator);

            try
            {
                Thread.Sleep(5000);
                addToListButton.webElement.Click();
            }
            catch (Exception)
            {
                addToListButton = offeringSummary.GetElementWaitByCSS(this.addToListButton.locator);
                addToListButton.webElement.Click();
            }
            AddListModal = new AddListModal(base.Driver);
            offeringSummary.GetElementWaitUntilByXpath(AddListModal.modal.locator,
                                                       (el) => el.Displayed, 15);
        }