使用Chrome扩展程序将控制面板添加到任何Chrome页面

时间:2018-01-15 23:53:57

标签: javascript google-chrome google-chrome-extension

当使用Selenium / Puppeteer自动化Chrome时,我们会在页面顶部看到一个面板:

  

chrome由自动测试软件控制

我的问题是 - 有没有办法使用Chrome扩展程序将这样的面板添加到任何Chrome页面?我想在任何与我的Chrome扩展程序有关的页面上添加控件,但我不想干扰页面本身,如果我可以避免它。

换句话说,我不想将JS注入用户的页面,我想将一些面板添加到Chrome或Chrome Dev Tools。

我希望添加一个如下所示的面板:

enter image description here

如果可能的话,我希望能够在面板上添加一些控件(按钮/事件处理程序)!

1 个答案:

答案 0 :(得分:1)

没有js的唯一方法是注入这样的自定义CSS样式:



body:before
{
  content:"You are being watched...";
  position: fixed;
  height: 50px;
  top: 0;
  left: 0;
  right: 0;
  background-color: darkred;
  color: antiquewhite;
  line-height: 50px;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 100%;
  z-index: 99999;
  pointer-events: none;
  opacity: 0.8;
}




相关问题