Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
wadezone
Frequent Visitor

Report testing Automation (using Playwright) - unable to click button

have been asked to figure out report automation testing for our analtyic reports on our internal company site.
The reports are done in Power BI.
I need to be able to search for something, drill through, get a value on the report and check it against a database.
I haven't been able to find where others are doing something like this.

 

I tried using the selenium IDE and recorder, Cypress, and Playwright.
I am having the most success with Playwright but continue to hit some road blocks.

 

I have a search button and a clear button on the report. I can 't get Playwright to click on either one of the buttons.

I have tried from the "page" and from the "frame" objects the different possible methods/events with no luck.
I am succesful in finding the frame with the following lines of code

const frame = page.frames().find(frame => frame.name() === 'visual-sandbox');
console.log(frame.name());

After typing in the search button the value to search, I tried to do a "enter" which should also trigger the search button.

I have tried so many things that I didn't keep a running list.

Examples below, I tried doing the same from the "await frame ...."

await page.click('//button[normalize-space(.)="Cear"]');
await page.dispatchEvent('button#c-glyph.search-button', 'click');
await page.click('search-button');
await page.press('#sandbox-host > div', "Enter");


const [response] = await Promise.all([
page.waitForNavigation(), // The navigation promise resolves after navigation has finished
page.click('#sandbox-host > div > button.c-glyph.search-button'),
//]);

I got the furthest with the following line where it looks like it knew what I was asking.
const hrefElement = await frame.$('#sandbox-host > div > button.c-glyph.search-button');
await hrefElement.click();

(node:31864) UnhandledPromiseRejectionWarning: TimeoutError: elementHandle.click: Timeout 30000ms exceeded.
=========================== logs ===========================
[api] attempting click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (948.83,198.06)
[api] element does not receive pointer events
[api] retrying click action
[api] waiting for element to be visible, enabled and not moving

Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.

Looking at the Chrome Dev Tools inspection, this is what I get for different portions of the element for search button.

	SearchButtonOutter
	"copy selector"
	#sandbox-host > div > button.c-glyph.search-button

	"copy JS Path"
	document.querySelector("#sandbox-host > div > button.c-glyph.search-button")

	"copy element":
	<button class="c-glyph search-button" name="search-button">
	                                          <span class="x-screen-reader">Search</span>
	                                        </button> 

	SearchButtonInner
	there isn't anything to copy for the element, but I can get this from the inspect styles section
	.visual-textFilter25A4896A83E0487089E2B90C9AE57C8A .text-filter-search button.search-button:before {

 

I could use some help on the right way to reference the click method for the buttons. I have attached screen shots to show you what I am trying to click on.

SearchButtonInner.JPGSearchButtonOutter.JPG

 
1 ACCEPTED SOLUTION

Not sure why my reply back wasn't working. Third attempt. Thanks Greg for the link to the article. No, I had not seen that. My testing needs to mimic the user's experence within the visuals. Our reports do use DAX queries but not from the original source. I can see maybe trying to incorporate the DAX Sudio to query against the original source and then verify it against the visual. It is definitely something I will check out. To mimic the user's maniuplation of the visuals I will still need to automate the objects on the report in the website. 

 

In case someone else is trying to get the button action to happen, I did get this to work with the frame object but not the page. I did the following:

 

const test = await frame.evaluate(() =>
document.querySelector("#sandbox-host > div > button.c-glyph.search-button").click()
);

 

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@dm-p 

@wadezone Have you seen this article? https://powerpivotpro.com/2018/09/automated-testing-using-dax-for-power-bi/



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello @Greg_Deckler ,

Thanks for sharing the link.  Do you think that the approach suggested in your link would work on a report which has been authored on top of a shared dataset?

 

Please bear in mind that the report has DAX functions which I would like to test.

 

Thanks,

Sau

 

Not sure why my reply back wasn't working. Third attempt. Thanks Greg for the link to the article. No, I had not seen that. My testing needs to mimic the user's experence within the visuals. Our reports do use DAX queries but not from the original source. I can see maybe trying to incorporate the DAX Sudio to query against the original source and then verify it against the visual. It is definitely something I will check out. To mimic the user's maniuplation of the visuals I will still need to automate the objects on the report in the website. 

 

In case someone else is trying to get the button action to happen, I did get this to work with the frame object but not the page. I did the following:

 

const test = await frame.evaluate(() =>
document.querySelector("#sandbox-host > div > button.c-glyph.search-button").click()
);

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.