private LotDto ParseLot(IWebElement lotDiv) { try { var a = lotDiv.FindElement(By.CssSelector("a[class=\"goods-tile__picture\"]")); var imgElement = lotDiv.FindElement(By.CssSelector("img")); string title = imgElement.GetAttribute("title"); if (!keywordsRegex.IsMatch(title)) { return(null); } string link = new string(a.GetAttribute("href").TakeWhile(x => x != '?').ToArray()); string imgLink = imgElement.GetAttribute("src"); string priceStr = lotDiv.FindElement(By.CssSelector("span[class=\"goods-tile__price-value\"]")).Text; priceStr = new string(priceStr.Where(x => x != ' ').ToArray()); decimal price = decimal.Parse(new string(priceStr.TakeWhile(x => Char.IsDigit(x)).ToArray())); int grams = ParsingUtils.GetGrams(title); return(new LotDto() { Shop = this.shop, ImageLink = imgLink, Link = link, Manufacturer = null, Title = title, WeightInGrams = grams, Price = new PriceDto() { Date = DateTime.Now, Value = price } }); } catch (Exception ex) { return(null); } }