I just tested this functionality using the Power BI Embedded Playground -> Sample Report, which is a great way to test SDK functions.
The following snippet is functional and provided by the Power BI Embedded Playground.
// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];
// Get a reference to the embedded report.
report = powerbi.get(embedContainer);
// Retrieve the page collection and loop through to collect the
// page name and display name of each page and display the value.
report.getPages()
.then(function (pages) {
var log = "Report pages:";
pages.forEach(function (page) {
log += "\n" + page.name + " - " + page.displayName;
});
Log.logText(log);
})
.catch(function (error) {
Log.log(error);
});
> Loaded
> Report pages:
> ReportSectioneb8c865100f8508cc533 - Tiles
ReportSection600dd9293d71ade01765 - Market Share
ReportSectiona271643cba2213c935be - YTD Category
ReportSection1c45b5dc6513ae89b4e3 - Sentiment
ReportSection2ff5a27ac612830bbd93 - Tooltip
ReportSection6da8317ad6cbcae5b3bb - Empty Page
> Rendered