To find the value in an InfoPath form, we had to take a different approach than when using the DispForm.aspx page.
As usual, we loaded the .js file in the SharePoint site via a document library, and used either Firefox or Chrome to find the id of the textbox or element that stored the value we wanted to put into localStorage.