Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (11.1k points)

How can I click a click a button in the power bi interface, i have tried a didn't work for me

await page.ClickAsync(".themableBackgroundColor");

Url Power Bi:

 https://app.powerbi.com/view?r=eyJrIjoiNGE3Mjg4OWMtZTFhYi00MDUyLTllNzAtNDJmOGE4NjY2MzMwIiwidCI6IjhhNDc1YTdmLThlOGYtNDliMi1iMDRkLTZlY2IwNTkzYzYzMyJ9

Image of Power Bi buttons:

Image of Power Bi buttons

Example code Html:

 <button type="button" class="themableBackgroundColor" style="width: 40px; height: 40px; overflow: hidden; position: relative; display: block; background-color: transparent; cursor: pointer;">

<span class="button-text" style="text-align: right; max-width: 32px; pointer-events: none; color: rgb(102, 102, 102); font-family: &quot;Segoe UI&quot;, wf_segoe-ui_normal, helvetica, arial, sans-serif; font-size: 13.3333px; position: absolute; right: 4px; top: 20px;"></span>
<div class="button-icon"><svg viewBox="0 0 22.59 32" width="32" height="32" style="fill: none; pointer-events: none; position: absolute; left: 4px; top: 4px;"><polygon points="20.04 29.25 11.21 25.43 2.37 29.25 2.37 2.5 20.04 2.5 20.04 29.25" style="vector-effect: non-scaling-stroke; stroke-width: 3px; stroke: rgb(102, 102, 102); stroke-opacity: 1;"></polygon></svg></div>
<div class="button-outline" style="pointer-events: none; top: 0px; left: 0px; position: absolute; width: 40px; height: 40px; border: none;"></div>
</button>

 

1 Answer

0 votes
by (22.5k points)
edited by

Use the following function to click the button using script:

let btn = document.querySelector(".themableBackgroundColor")
btn.addEventListener("click", () => console.log("Button Clicked!"))
btn.click();

If you want to learn more about Power BI, then read Power BI Tutorial. Also, enroll in Power BI Training to become proficient in this BI tool. 

Related questions

0 votes
1 answer
0 votes
1 answer
asked Dec 30, 2020 in BI by Chris (11.1k points)
0 votes
1 answer
asked Jan 12, 2021 in BI by dev_sk2311 (45k points)

Browse Categories

...