The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
We have developed a custom powerbi visual and would like to automate the accessibility tests(or for that matter, running e2e tests). We explored selenium-webdriver and cypress to run accessibility tests(both use axe-core library internally) on a given powerbi report link that contains the custom visual, but unofrtunately they can't find any element of the visual. I am guessing maybe due to the sandboxed iframe environment. Does anyone have any experience automating the accessibility test using any tool for a custom visual?
P.S. I've tried running cypress and selenium on a Angular project, and both run perfectly fine. Also, the test for powerbi visual is able to get to the report. Hence, assuming it's not an issue with the tool or accessing the report. If I could figure out a way to access the html elements of custom visual (like a button inside the visual) using any browser automation tool, the problem should be solved!
Hi @taghos
I haven't personally got into these frameworks for automated testing, so I'm not sure how granular you can be with how to access elements. Typically, selecting an element from a higher-order element (i.e. main window into an embedded iframe) should work.
Although the DOM is slightly different for custom visuals in edit vs. reading mode, using a CSS selector to get to the div element by ID (sandbox-host) within the visual from the main window should still yield results if the tooling can work with the entire page.
Your mileage may vary but I've just done a quick test with the jQuery instance available in the main window, and this works as I might expect:
If there are multiple unique custom visuals in the report page DOM, then this may not be specific enough, so an ID and class selector that matches the visual guid from your pbiviz.json can also work, e.g.:
This would be in the format #sandbox-host.visual-{guid}
It looks like Selenium supports the use of CSS selectors, so this might provide an option if you haven't already tried this approach.
While researching I also found this article, which suggests there might be some special handling of iframes when using Selenium. This may apply for custom visuals also.
Good luck!
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
2 | |
1 | |
1 | |
1 |