Пример #1
0
 public BaseElement(By locator, string name)
 {
     this.Name    = name;
     this.driver  = SingleWebDriver.GetInstance();
     this.locator = locator;
     Logger.GetInstance().LogLine($"Created '{Name}' element.");
 }
Пример #2
0
        public static List <SteamGame> GetDiscountedGames(string selector, string namesSelector)
        {
            IWebDriver driver = SingleWebDriver.GetInstance();

            IReadOnlyCollection <IWebElement> gotButtons   = driver.FindElements(By.XPath(selector));
            IReadOnlyCollection <IWebElement> gotNames     = driver.FindElements(By.XPath($"{selector}{namesSelector}"));
            IReadOnlyCollection <IWebElement> gotDiscounts = driver.FindElements(By.XPath($"{selector}{discountsSelector}"));
            IReadOnlyCollection <IWebElement> gotOldPrices = driver.FindElements(By.XPath($"{selector}{oldPricesSelector}"));
            IReadOnlyCollection <IWebElement> gotNewPrices = driver.FindElements(By.XPath($"{selector}{newPricesSelector}"));

            List <SteamGame> steamGames = new List <SteamGame>();
            int i = 0;

            foreach (IWebElement element in gotButtons)
            {
                string discount       = gotDiscounts.ElementAt(i).GetAttribute(innerText);
                string oldPrice       = gotOldPrices.ElementAt(i).GetAttribute(innerText);
                string newPrice       = gotNewPrices.ElementAt(i).GetAttribute(innerText);
                string name           = gotNames.ElementAt(i).GetAttribute(innerText);
                string uniqueSelector = $"{selector}/..//*[text()=\"{name}\"]";

                steamGames.Add(new SteamGame(discount, oldPrice, newPrice, By.XPath(uniqueSelector), name));
                i++;
            }
            return(steamGames);
        }
Пример #3
0
 public BaseElement(By locator, string name)
 {
     this.Name    = name;
     this.driver  = SingleWebDriver.GetInstance();
     this.locator = locator;
 }
Пример #4
0
 public PageObject()
 {
     this.driver = SingleWebDriver.GetInstance();
 }
Пример #5
0
 public BaseForm()
 {
     this.driver = SingleWebDriver.GetInstance();
 }
Пример #6
0
 public Select(By locator, string name) : base(locator, name)
 {
     elements = new SelectElement(SingleWebDriver.GetInstance().FindElement(locator));
 }
Пример #7
0
 public void Setup()
 {
     SingleWebDriver.GetInstance();
     Configuration = SingleWebDriver.Configuration;
 }
Пример #8
0
 public void Setup()
 {
     SingleWebDriver.GetInstance();
     Configuration = new TestConfiguration($"{Path.GetFullPath("..\\..\\..\\")}/config.json");
 }