美文网首页我爱编程
JavaScript脚本自动操作浏览器

JavaScript脚本自动操作浏览器

作者: wwmin_ | 来源:发表于2018-05-28 17:09 被阅读20次

利用js模拟人为操作可以做很多机械化的操作,例如批量删除微博

'use strict';
var s = document.createElement('script');
s.setAttribute(
  'src',
  'https://lib.sinaapp.com/js/jquery/2.0.3/jquery-2.0.3.min.js'
);
s.onload = function() {
  setInterval(function() {
    if (!$('a[action-type="feed_list_delete"]')) {
      $('a.next').click();
    } else {
      $('a[action-type="feed_list_delete"]')[0].click();
      $('a[action-type="ok"]')[0].click();
    }

    // scroll bottom let auto load
    $('html, body').animate({ scrollTop: $(document).height() }, 'slow');
  }, 800);
};
document.head.appendChild(s);

有这方面需求的可以简单的学习js然后对就可以做很多很酷的事了...

相关文章

网友评论

    本文标题:JavaScript脚本自动操作浏览器

    本文链接:https://www.haomeiwen.com/subject/wgigjftx.html