Forum Discussion
Automated Accessibility Testing for custom powerbi visual
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