Created
November 6, 2015 15:21
-
-
Save margusmartsepp/784126ffa00b100ef628 to your computer and use it in GitHub Desktop.
Get data from gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static string _pass = "***"; | |
| private static string _user = "[email protected]"; | |
| private static string _puri = "https://www.pivotaltracker.com/n/projects/1155920"; | |
| [Test] | |
| public void ReadPivot() | |
| { | |
| using (var d = new ChromeDriver()) | |
| { | |
| d.Navigate().GoToUrl(_puri); | |
| d.FindElement(By.Id("credentials_username")).SendKeys(_user); | |
| d.FindElement(By.Id("credentials_password")).SendKeys(_pass); | |
| d.FindElement(By.Id("credentials_password")).Submit(); | |
| d.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 1, 0)); | |
| var panels = d.FindElements(By.ClassName("panel")); | |
| var sb = new StringBuilder(); | |
| foreach (var panel in new[] { "current", "backlog", "icebox" }) | |
| { | |
| sb.AppendLine().AppendLine(panel.ToUpper()); | |
| var backlog = panels.First(o => o.GetAttribute("data-type") == panel); | |
| var items = backlog.FindElements(By.ClassName("story")); | |
| d.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 0)); | |
| int i = 1; | |
| foreach (var item in items) | |
| { | |
| var storyName = item.FindElement(By.ClassName("story_name")).Text; | |
| if (item.FindElements(By.ClassName("owner")).Count != 0) | |
| { | |
| var owners = item.FindElements(By.ClassName("owner")); | |
| var ol = new List<string>(); | |
| foreach (var owner in owners) | |
| { | |
| ol.Add(owner.GetAttribute("title")); | |
| } | |
| sb.AppendLine(string.Format("{2}) {0} ({1})", storyName, string.Join(", ", ol), i)); | |
| } | |
| else | |
| { | |
| sb.AppendLine(string.Format("{1}) {0}", storyName, i)); | |
| } | |
| i++; | |
| } | |
| } | |
| Console.WriteLine(sb.ToString()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment