[英]Getting webpage elements by class using Keyboard Maestro
I frequently go to a library results page that has two pieces of information I want: 我经常去图书馆结果页面,该页面包含我想要的两条信息:
<h1>
with class="title"
列表标题:一个带有class="title"
的<h1>
<td>
with class="call"
呼叫号码:带有class="call"
<td>
I want to be able to automatically copy the content of these two elements to a couple of named clipboards. 我希望能够自动将这两个元素的内容复制到几个命名剪贴板中。 Is this possible? 这可能吗?
Awesome person, ComplexPoint, answered this on the KM forums here 真棒人,ComplexPoint,回答了这个对KM论坛在这里
(function (strPath) {
var r = document.evaluate(strPath, document, null, 0, null),
lst = [],
oNode;
while (oNode = r.iterateNext()) {
lst.push(oNode.className + ' = ' +oNode.textContent);
}
return lst.join('\n');
})("//h1[@class='title'] | //td[@class='call']")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.