【问题标题】:Getting webpage elements by class using Keyboard Maestro使用键盘大师按类获取网页元素
【发布时间】:2015-08-29 00:50:23
【问题描述】:

我经常访问包含两条我想要的信息的图书馆结果页面:

  • 列表标题:<h1>class="title"
  • 电话号码:A <td>class="call"

我希望能够自动将这两个元素的内容复制到几个命名的剪贴板。这可能吗?

【问题讨论】:

    标签: keyboard-maestro


    【解决方案1】:

    了不起的人,ComplexPoint,在知识管理论坛上回答了这个问题here

    (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']")
    

    【讨论】:

      猜你喜欢
      • 2016-10-06
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      • 2020-10-30
      • 2013-06-18
      • 2012-07-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多