无法单击要在Selenium中使用的在Chrome中使用Javascript的按钮

无法单击要在Selenium中使用的在Chrome中使用Javascript的按钮,javascript,Javascript,我试图在Selenium中单击一个按钮以获取脚本,但首先我尝试在chrome控制台中使用JavaScript单击该按钮,但是与其他站点相比,这是很困难的 我已经试过了。点击、.trigger(“点击”)等等 元素源代码: <paper-icon-button icon="festify:favorite-border" title="Vote for Eastside (with Halsey &amp; Khalid)" role="button" tabindex="0" ar

我试图在Selenium中单击一个按钮以获取脚本,但首先我尝试在chrome控制台中使用JavaScript单击该按钮,但是与其他站点相比,这是很困难的

我已经试过了。点击、.trigger(“点击”)等等

元素源代码:

<paper-icon-button icon="festify:favorite-border" title="Vote for Eastside (with Halsey &amp; Khalid)" role="button" tabindex="0" aria-disabled="false"></paper-icon-button>

测试JS的示例:

document.getElementsByTagName("paper-icon-button").click();
VM1691:1 Uncaught TypeError: document.getElementsByTagName(...).click is not a function
    at <anonymous>:1:52
document.getElementsByTagName(“纸张图标按钮”)。单击();
VM1691:1未捕获类型错误:document.getElementsByTagName(…)。单击不是函数

at-(由于明显的原因不是我的队列)

正如函数所说,
document.getElementsByTagName
返回元素列表,即使该列表只包含一个元素

如果希望只获取一个元素,请执行类似于
document.getElementsByTagName(…)[0]的操作。单击()。否则,在列表上循环并执行
元素。在每个元素上单击()