简体   繁体   English

使用Keyboard Maestro按类获取网页元素

[英]Getting webpage elements by class using Keyboard Maestro

I frequently go to a library results page that has two pieces of information I want: 我经常去图书馆结果页面,该页面包含我想要的两条信息:

  • The Listing Title: An <h1> with class="title" 列表标题:一个带有class="title"<h1>
  • The Call Number: A <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.

相关问题 避免使用Keyboard Maestro上的一键快捷键的文本字段 - Avoid text fields for one-key shortcuts on Keyboard Maestro 将AppleScript重写为appscript-rb,在Keyboard Maestro中设置变量 - Rewriting AppleScript to appscript-rb, setting variable in Keyboard Maestro 如何在Keyboard Maestro中模拟HOLDING键击? - How to simulate HOLDING a keystroke in Keyboard Maestro? 格式化正则表达式输出(适用于Keyboard maestro)。 - Formatting regular expression output (for Keyboard maestro). 使用shift修改器按住大写字母并按住Keyboard Maestro键 - Making a capital letter with a shift modifier press and hold option with Keyboard Maestro 键盘大师。 如何在“打开文件”对话框中选择文件? - Keyboard Maestro. How to select a file in an “Open file” dialog? 使用Keyboard Maestro将光标向前移动一个空格 - Use Keyboard Maestro to move the cursor one space forward TIS / TSM非主线程错误;热键触发的pygame脚本(臀部,pygame,键盘) - TIS/TSM non-main thread error; pygame script triggered by hotkey (rumps, pygame, keyboard) 如何使用纯JavaScript激活级联下拉自动选择 - How to activate Cascading Dropdown auto-selection using pure javascript 如何创建一个使用自定义词边界获取N个单词的RegEx模式? - How Can I Create a RegEx Pattern that will Get N Words Using Custom Word Boundary?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM