Пример #1
0
        public void AddRandomItems(string quantity)
        {
            SearchBox.SendKeys("Henleys Mens Milo Canvas Pumps");
            SubmitSearch.Click();

            var results     = Driver.FindElements(By.CssSelector("div.a-fixed-left-grid-col.a-col-left"));
            var firstResult = results[0];

            firstResult.Click();
            SelectSizeDropdown.Click();
            Thread.Sleep(2000);
            var sizes = Driver.FindElements(By.XPath("//*[@id='native_dropdown_selected_size_name']/option"));
            var firstAvailableSize = sizes[2];

            firstAvailableSize.Click();
            Thread.Sleep(2000);
            QuantityDropdown.Click();
            var quantityDropdown = Driver.FindElements(By.XPath("//*[@id='quantity']/option"));

            foreach (IWebElement option in quantityDropdown)
            {
                if (option.Text.Contains(quantity))
                {
                    option.Click();
                    break;
                }
            }
        }
Пример #2
0
        public void RemoveSelectedProduct()
        {
            waitMechanism.ExplicitWaitByXPath(webDriver, 20, QuantityDropdownXPath);

            QuantityDropdown.Click();
            Thread.Sleep((int)ScriptWaits.SmallWait);

            QuantityDropdownRemoveOption.Click();
        }