简体   繁体   中英

Javascript click() is not working on a button

I have a button that has following HTML structure:

HTML 树

When the button is inspected it points to last line:

<div class="gw-label"><div class="gw-shortcutKey">E</div>dit Account</div>

However, following line is not clicking the button (nor it is returning an error):

document.getElementById("AccountFile_Summary-AccountFile_SummaryScreen-EditAccount").children[0].children[1].click()

Any suggestions?

I tried followings, but did not work:

document.getElementById("AccountFile_Summary-AccountFile_SummaryScreen-EditAccount").click()
document.getElementById("AccountFile_Summary-AccountFile_SummaryScreen-EditAccount").children[0].click()

Could you use the following if the button is the only instance of the class 'gw-action--inner'?

document.querySelector('.gw-action--inner').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