[英]clicking a button in javascript without button id or class
I'm trying to use AppleScript to click a button on a webpage, however the button I need to click doesn't have an ID or Class, and it's located inside a div/input tag:我正在尝试使用 AppleScript 单击网页上的按钮,但是我需要单击的按钮没有 ID 或 Class,它位于 div/input 标签内:
<div style="margin:0;padding:0;position:absolute;width:100px;right:20px"><input style="padding:4px;height:2em;width:100px" type="submit" value="save" tabindex="-1"></div>
<input style="padding:4px;height:2em;width:100px" type="submit" value="save" tabindex="-1">
I tried using querySelector, but it didn't work.我尝试使用 querySelector,但它不起作用。 How do I go about clicking this button?
我如何点击这个按钮?
In this case an attribute selector would work fine, I'd imagine.在这种情况下,我想一个属性选择器可以正常工作。
document.querySelector('input[value="save"]')
More information from MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors来自 MDN 的更多信息: https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.