0

Im trying to make a powershell script that retrieves a value from our Jira website using Invoke-WebRequest. So far i tried this, without success:

$URI = "https://jira-marine.johnsoncontrols.com/browse/MST-3846"
#$URI = "https://superwidgets.wordpress.com/category/sql/"
$HTML = Invoke-WebRequest -Uri $URI
#$HTML.ParsedHtml | Get-Member
$HTML.ParsedHtml.getElementById('customfield_23231-val').value 
#$HTML.ParsedHtml.getElementsByTagName('('customfield_23231')
($HTML.ParsedHtml.getElementsByTagName('input') | Where{ $_.className -eq 'customfield_23231'}).innerText
#($HTML.ParsedHtml.getElementsByTagName('h2') | Where{ $_.className -eq 'entry-title'}).innerText

I've included a screenshot from the websites DOM, how do I get that value (664597)? Is it a issue with access to the page, as it require login?

DOM from website

aynber
  • 22,380
  • 8
  • 50
  • 63
  • 1
    Try using HtmlAgilityPack: https://html-agility-pack.net/ it has been really helpful for me. See this article for how to authenticate on a website: https://stackoverflow.com/questions/23298532/htmlagilitypack-and-authentication – frankM_DN Oct 11 '22 at 13:52
  • 4
    You *might* be better off using the JIRA API if that's an option - see https://developer.atlassian.com/cloud/jira/platform/rest/v3/ - that way you won't have to parse html at all... – mclayton Oct 11 '22 at 13:53

0 Answers0