0

描述:

下午好社区,你能帮我知道如何单击 Power BI 界面中的按钮吗?我正在尝试这个,但它对我不起作用

await page.ClickAsync(".themableBackgroundColor");

网址电源双

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

Power Bi 按钮图片

Power Bi 按钮的图像

示例代码 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>
4

1 回答 1

0

只需使用此功能通过脚本单击按钮:

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

于 2020-09-16T23:21:49.570 回答