cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Highlighted

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

2 REPLIES 2
Highlighted
Super User IV
Super User IV

@dm-p 

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


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors