单击 javascript 中没有按钮 ID 或 class 的按钮
clicking a button in javascript without button id or class
我正在尝试使用 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">
我尝试使用 querySelector,但没有用。我该如何点击这个按钮?
我想在这种情况下,属性选择器可以正常工作。
document.querySelector('input[value="save"]')
来自 MDN 的更多信息:https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
我正在尝试使用 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">
我尝试使用 querySelector,但没有用。我该如何点击这个按钮?
我想在这种情况下,属性选择器可以正常工作。
document.querySelector('input[value="save"]')
来自 MDN 的更多信息:https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors