/// <summary> /// Command Rank. /// </summary> public double CommandRank(string name) { var rows = TableRows.ToList(); var row = rows.First(x => x.FindElement(By.CssSelector(".team_name_span a")).Text.Contains(name)); var rank = row.FindElement(By.CssSelector(".rank")).Text.Trim('.'); return(Double.Parse(rank)); }
/// <summary> /// Games Number. /// </summary> public double DifferenceScoredAndMissedGoals(string name) { var rows = TableRows.ToList(); var row = rows.First(x => x.FindElement(By.CssSelector(".team_name_span a")).Text.Equals(name)); var points = row.FindElements(By.CssSelector(".goals"))[0].Text.Split(':'); return(Double.Parse(points[0]) - Double.Parse(points[1])); }
/// <summary> /// Points Total In 5 Previous Mathes. /// </summary> public int PointsTotalIn5Mathes(string name) { var rows = TableRows.ToList(); var row = rows.First(x => x.FindElement(By.CssSelector(".team_name_span a")).Text.Contains(name)); var games = row.FindElements(By.CssSelector(".col_form div a")) .Select(x => x.GetAttribute("title")).ToList(); int points = 0; foreach (var prevGame in games) { string[] separatingChars = { "[b]", ":", " [/b](", "-", ")\r\n" }; string[] words = prevGame .Split(separatingChars, System.StringSplitOptions.RemoveEmptyEntries); if (!words.Length.Equals(3)) { if (words.ElementAt(2).Trim().Equals(name)) { if (Double.Parse(words.ElementAt(0)) > Double.Parse(words.ElementAt(1))) { points = points + 3; } if (Double.Parse(words.ElementAt(0)) == Double.Parse(words.ElementAt(1))) { points = points + 1; } } if (words.ElementAt(3).Trim().Equals(name)) { if (Double.Parse(words.ElementAt(0)) < Double.Parse(words.ElementAt(1))) { points = points + 3; } if (Double.Parse(words.ElementAt(0)) == Double.Parse(words.ElementAt(1))) { points = points + 1; } } } } return(points); }