Forum Discussion
knyazs
9 years agoRegular Visitor
Check if PowerBI page is loaded (using Selenium)
Hi! I am using Selenium to automate load and performance testing of PowerBI reports and I need a reliable way to pause code execution until page is fully loaded (all queries executed and all slic...
ekeijl
9 years agoHelper I
There are quite some code samples on the Github wiki, I suggest you check them out.
It would look something like this (combined this and this):
// HTML
<div
powerbi-type="report"
powerbi-report-id="5dac7a4a-4452-46b3-99f6-a25915e0fe55"
powerbi-embed-url="https://app.powerbi.com/reportEmbed"
></div>
// JS
var embedConfiguration = {
type: 'report',
id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55',
embedUrl: 'https://app.powerbi.com/reportEmbed'
};
var $reportContainer = $('#reportContainer');
var report = powerbi.embed($reportContainer.get(0), embedConfiguration);
// Here we listen for the loaded event
report.on('loaded', event => {
// Here the reports are loaded, do something that can be detected by Selenium.
$('#reportContainer').addClass('done-loading');
});
knyazs
9 years agoRegular Visitor
ekeijl powerbi-type, powerbi-report-id and powerbi-embed-url are properties that don't exist in the report until you embed report somewhere else - that is when report gets id as well.
I wouldn't want to embed PowerBI report, I just need to find some existing element (document, window or something third) to attach to and inject or execute JS to check if page is loaded.