[英]How to make a "click" as I got the DOM of the button with chrome extension?
I would like to make a mouse left click on a button in a website using chrome extension.我想使用 chrome 扩展在网站上的按钮上单击鼠标左键。 The target website is https://www.urlgot.com/ .
目标网站是https://www.urlgot.com/ 。 It is a seemly simple webpage with only one button.
这是一个看似简单的网页,只有一个按钮。 I had found a solution to get my interesting DOM content and how to paste text into the textbox .Then how to make a click to the button?
我找到了一个解决方案来获取我有趣的 DOM 内容以及如何将文本粘贴到文本框中。那么如何点击按钮? As a neophyte in chrome extension scripting, I really need some advice.
作为 chrome 扩展脚本的新手,我真的需要一些建议。
The DOM of interesting is as below,有趣的DOM如下,
<button type="button" class="button button-action button-circle button-raised" id="parseButton" onclick="parse()"><i class="fa fa-check"></i></button>
I am confused with how to make the click.我对如何进行点击感到困惑。 Thank you.
谢谢你。
以下代码可以完成这项工作:
document.getElementById("parseButton").click();
You can use jQuery to click您可以使用 jQuery 单击
$('#parseButton').click()
or Javascript或 Javascript
document.getElementById('parseButton').click()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.