window 系统里 chrome 浏览器一些实用的调试技巧

简介: window 系统里 chrome 浏览器一些实用的调试技巧

说明

某一天,我突然发现 chrome 浏览器竟是熟悉的陌生人,感觉好多操作都不知道,于是,我看了一些大佬写的笔记,自己把不会的一些整理了一下,记录起来,忘记的时候偶尔来看一看。



1、开发者工具里 Run Command

打开 Chrome 开发者工具,然后使用快捷键 Ctrl + Shift + P 打开命令菜单:


78e8cd6f96d64ddda035c1c780180271.png


1.1 切换 chrome 主题


输入下面命令可以进行主题切换


  • Switch to dark theme
  • Switch to light theme

也可以输入 theme ,下面就会出现主题的切换,比如你现在是 light 主题,就会给你 dark 主题的切换选择

cae631710582462cb6b3d0146f33caca.png


选了这之后,开发者工具就变成了 dark 主题


d0b6d7a04d1c4ade81d3d89bbcf57000.png



1.2 屏幕截图


  • Capture full size screenshot:用于截取网页上所有内容的屏幕快照,包括可视窗口中未出现的所有内容
  • Capture node screenshot:用于精确捕获 DOM 元素的内容


比如:我选择第一个命令 Capture full size screenshot

1a93240dc379466598de5bf09baaa29b.png


就会下载下来一张图片:可以看到这张图片,出现了页面未出现的所有内容

c05e8af1ecf3450abb96c2da5edc97e7.png


我们先选中这个 a 标签:


bce85a839c96471a8088a2ab76cc50ac.png


在使用第二个命令:


71bba612bcf94d15bb18b9e36c7624b2.png


我们可以看到下载下来就是 a 标签这个部分的。

dae9b9cac5554351814f5e2df2a6b3ad.png



2、开发者工具里 Network


2.1 重新发送XHR请求


  • 打开网络面板
  • 点击 Fetch/XHR 按钮
  • 选择重新发送的 XHR 请求
  • 重发 Replay XHR


35255cae57644fdd9f90bf60a132cd4f.png



2.2 在控制台用 fetch 快速发起请求

  • 选择重新发送的 XHR 请求
  • 右键选择 copy 里的 Copy as fetch
  • 粘贴到控制台
  • 可以自己修改参数,回车执行


1f8b7e6069aa4d5082e03ffaa229faf8.png


粘贴 Ctrl + v 到控制台执行:

ce5e4516f1eb4031bf911c391b25376f.png

你就发现调用了:


2feffbbc72c34442a8cdf6ae0f0b736c.png


2.3 复制图片的Data URI

找到图片的 preview 然后右击选择 Copy image as data URI


a7990721c99e4b61b0860a76213073e0.png


下面链接就可以直接在浏览器上访问

data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTc2cHgiIGhlaWdodD0iMTcycHgiIHZpZXdCb3g9IjAgMCAxNzYgMTcyIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPHRpdGxlPue8lue7hCAy5aSH5Lu9IDI8L3RpdGxlPgogICAgPGRlZnM+CiAgICAgICAgPHJhZGlhbEdyYWRpZW50IGN4PSIzOC4xNzQ3MjEzJSIgY3k9Ijg2LjA3NzY2MDElIiBmeD0iMzguMTc0NzIxMyUiIGZ5PSI4Ni4wNzc2NjAxJSIgcj0iOTcuMDY3Mzc5JSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgwLjM4MTc0NywwLjg2MDc3Nyksc2NhbGUoMC44NTUzNjUsMS4wMDAwMDApLHJvdGF0ZSgtNDYuMzAwNTEyKSx0cmFuc2xhdGUoLTAuMzgxNzQ3LC0wLjg2MDc3NykiIGlkPSJyYWRpYWxHcmFkaWVudC0xIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzE3OEY2NyIgb2Zmc2V0PSIwJSI+PC9zdG9wPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjMzFDQzc5IiBzdG9wLW9wYWNpdHk9IjAuNTUiIG9mZnNldD0iNTQuNjg0NzY4NCUiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzUzRTY4RCIgc3RvcC1vcGFjaXR5PSIwLjgiIG9mZnNldD0iMTAwJSI+PC9zdG9wPgogICAgIC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AgPC9nPgogICAgICAgICAgICA8ZyBpZD0iRmlsbC0xMi1Db3B5Ij4KICAgICAgICAgICAgICAgIDx1c2UgZmlsbD0iIzkzRTY1QyIgeGxpbms6aHJlZj0iI3BhdGgtNCI+PC91c2U+CiAgICAgICAgICAgICAgICA8dXNlIGZpbGwtb3BhY2l0eT0iMC43NSIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0zKSIgc3R5bGU9Im1peC1ibGVuZC1tb2RlOiBvdmVybGF5OyIgeGxpbms6aHJlZj0iI3BhdGgtNCI+PC91c2U+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==


51d7d50b9d4d46dc8ce9c7a5bb3b365d.png



2.4 页面不同時期的加载截图

选择 Capture Screenshots 获得页面加载的截图。


1b246356aa8d4bb2affff3ad0bd129f0.png



3、开发者工具里 Source

打开 Chrome 开发者工具,然后使用快捷键 Ctrl + P 打开文件:


250680f2d6c54a90913ef75051df0c07.png

3.1 快速切换文件

比如我们打开上面的 normalize.css 文件


b159a0ec8a2d43e797c223a800a0e6d9.png


3.2 在源代码中搜索

按住 Ctrl + Shift + f 进行搜索,这里不要把光标聚焦到源文件里面,不然出不来。

比:如搜索 mark 字段


6693eef14de6486893a93860be606002.png


3.3 源代码里跳转行数

ctrl + g,输入行数跳转

a70a0e1ad3ed4e42a7a44ea47d04ba19.png

比如在上面的文件里跳转到第 5 行

9081a593e33846859c518e9944c18397.png


3.4 通过 workspaces 实现编辑器功能

选择 Add folder to workspace,或者只是把整个工程文件夹拖放入Developer Tool,然后同意。就可以在开发者工具里编辑文件保存了。

4639cd8081c6406dab78646521229350.png


3.5 添加条件断点

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const blogs = [
        {
          name: "kaimo666",
          value: 666,
        },
        {
          name: "kaimo777",
          value: 777,
        },
        {
          name: "kaimo888",
          value: 888,
        },
      ];
      blogs.forEach((v) => {
        console.log(v.name, v.value);
      });
    </script>
  </body>
</html>


我们在 27 行打个断点,重新执行这段代码的时候,会停三下

822e346e394b43508d999dd8178ca1fc.png

我们在 27 行,右击选着编辑断点

0315cd1da9314ee3b127b168a43f59af.png

输入条件: v.name === "kaimo888",然后失焦就行



4529e8e923cb488793290ffff13a6e34.png


重新执行这段代码的时候,只有满足条件的才会停

bbe64eaa37e14d70be276a0e42c71513.png



目录
相关文章
|
2月前
|
存储 缓存 监控
|
3月前
|
Web App开发 数据采集 存储
WebDriver与Chrome DevTools Protocol:如何在浏览器自动化中提升效率
本文探讨了如何利用Chrome DevTools Protocol (CDP) 与 Selenium WebDriver 提升浏览器自动化效率,结合代理IP技术高效采集微博数据。通过CDP,开发者可直接操作浏览器底层功能,如网络拦截、性能分析等,增强控制精度。示例代码展示了如何设置代理IP、cookie及user-agent来模拟真实用户行为,提高数据抓取成功率与稳定性。适用于需要频繁抓取互联网数据的应用场景。
557 3
WebDriver与Chrome DevTools Protocol:如何在浏览器自动化中提升效率
|
23天前
|
人工智能 自然语言处理 JavaScript
Agent-E:基于 AutoGen 代理框架构建的 AI 浏览器自动化系统
Agent-E 是一个基于 AutoGen 代理框架构建的智能自动化系统,专注于浏览器内的自动化操作。它能够执行多种复杂任务,如填写表单、搜索和排序电商产品、定位网页内容等,从而提高在线效率,减少重复劳动。本文将详细介绍 Agent-E 的功能、技术原理以及如何运行该系统。
74 5
Agent-E:基于 AutoGen 代理框架构建的 AI 浏览器自动化系统
|
1月前
|
Web App开发 缓存 安全
WIN11 Chrome 双击打不开闪退及Chrome浏览器不能拖拽文件crx
【11月更文挑战第6天】本文介绍了 WIN11 系统中 Chrome 浏览器双击打不开闪退及不能拖拽文件 crx 的原因和解决方法。包括浏览器版本过旧、扩展程序冲突、硬件加速问题、缓存过多、安全软件冲突、系统文件损坏、用户配置文件损坏等问题的解决方案,以及 crx 文件的屏蔽、权限问题和文件格式问题的处理方法。
128 2
|
1月前
|
Web App开发 Linux iOS开发
Chrome浏览器如何导出所有书签并导入书签
【11月更文挑战第4天】本文介绍了如何在 Chrome 浏览器中导出和导入书签。导出时,打开书签管理器,点击“整理”按钮选择“导出书签”,保存为 HTML 文件。导入时,同样打开书签管理器,点击“整理”按钮选择“导入书签”,选择之前导出的 HTML 文件即可。其他主流浏览器也支持导入这种格式的书签文件。
348 2
|
1月前
|
Web App开发 JavaScript 前端开发
使用 Chrome 浏览器的内存分析工具来检测 JavaScript 中的内存泄漏
【10月更文挑战第25天】利用 Chrome 浏览器的内存分析工具,可以较为准确地检测 JavaScript 中的内存泄漏问题,并帮助我们找出潜在的泄漏点,以便采取相应的解决措施。
300 9
|
2月前
|
Web App开发 开发者
|
2月前
|
Web App开发 JSON 安全
Chrome浏览器的跨域问题
【10月更文挑战第6天】
|
2月前
|
Web App开发 JavaScript 前端开发
JavaScript Window - 浏览器对象模型
JavaScript Window - 浏览器对象模型
27 2
|
2月前
|
Web App开发 缓存 安全
Chrome浏览器启动参数大全
这是一组用于定制浏览器行为的命令行参数,包括但不限于:不停用过期插件、放行非安全内容、允许应用中心脚本、停用GPU加速视频、禁用桌面通知、禁用拓展及各类API、调整缓存设置、启用打印预览、隐身模式启动、设定语言、使用代理服务器、无头模式运行等。通过这些参数,用户可以根据需求灵活调整浏览器功能与性能。

热门文章

最新文章