Forum Discussion
Check if PowerBI page is loaded (using Selenium)
knyazs Might Selenium's built-in ImplicitWait help to solve your problem?
http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp
ddevogel Yes, I am currently using that mechanism (check code sample in my first post) and it works fine. The issue is that XPaths need to be taken for each element of each report and if report changes, code needs to be changed as well.
I was just wondering if there is something "universal" for PowerBI pages, such as some flag or tag on the page which I could reuse across muliple reports?
ekeijl Sounds promissing. As I only know basics of JavaScript / Web Dev, code sample of this approach would mean a lot :)
- ekeijl9 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'); });- knyazs9 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.