简体   繁体   中英

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. The target website is 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? As a neophyte in chrome extension scripting, I really need some advice.

The DOM of interesting is as below,

<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

$('#parseButton').click()

or Javascript

document.getElementById('parseButton').click()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM