Created
January 30, 2017 22:48
-
-
Save erd0s/a03ce752897e8dbe39baf6853b213d99 to your computer and use it in GitHub Desktop.
Scrape tickets from jira in the sprints/details view
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
/** | |
* Plop this into chrome dev console, once it's done the var tickets will be populated with ticket details. | |
* | |
* Handy if you need to get a bunch of jira tickets to offline versions for reading on a plane! | |
*/ | |
var tickets = []; | |
var cards = document.querySelectorAll(".ghx-backlog-card"); | |
var cardsLength = cards.length; | |
var currentCard = 0; | |
function getNext() { | |
var card = cards[currentCard]; | |
card.click(); | |
setTimeout(function() { | |
var ticketName = document.querySelector("dd#summary-val").innerText; | |
var ticketNumber = document.querySelector("dd#issuekey-val").innerText; | |
var ticketDescription = document.querySelector("div#description-val").innerText; | |
var comments = document.querySelector("div.issuePanelContainer").innerText; | |
currentCard++; | |
tickets.push({ | |
name: ticketName, | |
num: ticketNumber, | |
desc: ticketDescription, | |
comments: comments | |
}); | |
if (currentCard < cardsLength) { | |
getNext(); | |
} | |
else { | |
alert("Done"); | |
} | |
}, 3000); | |
} | |
getNext(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment