google-chrome-devtools 相关问题

Chrome DevTools是Google Chrome内置的网络开发者工具。

从server/index.js发送文件时无法在background.js接收文件(制作chrome扩展)

所以,我想在 Chrome 扩展中通过 socket.io 网络共享文件。 我的代码流程如下: 我在弹出窗口中有一个文件输入字段,用户可以在其中上传文件。我在

回答 1 投票 0

如何在Chrome中添加中国地区选项到GitLab注册时的电话号码验证中?

在 GitLab 注册新用户时,电话号码验证没有中国地区选项。如何在Chrome中使用DevTools添加中国地区选项(+86)?

回答 1 投票 0

Google Chrome - 开发工具 - 网络选项卡:设计更新

如何将最近更新的开发工具中的“请求类型”设计恢复到之前的版本? 我更新了 Chrome,现在请求类型的设计在

回答 1 投票 0

Redux 存储中的数据在 Chrome 开发工具中可见,但实际上无法访问

我将 React 与 Redux 结合使用,为执行以下操作的操作实现 Redux-Thunk: Thunk 调用 axios.get() 首先 then() 语句映射 JSON 以将键和值转换为前端

回答 1 投票 0

如何在 Chrome DevTools JavaScript 控制台中取消当前命令?

如何取消 Chrome DevTools JavaScript 控制台中的当前命令? Ctrl + C 不像在普通 shell CLI 终端上那样工作,没有任何反应。 我知道我可以按 Ctrl + L 清除 co...

回答 1 投票 0

如何通过负载的键值对中的特定值过滤浏览器中的网络请求?

例如,如果我们进入 OMDb API 示例页面,输入“test”按标题搜索电影,我们会得到以下响应: 现在,如果我们打开 Chrome 开发工具,转到网络选项卡,然后...

回答 1 投票 0

Chrome Performance DevTools 中不明确的“任务”

Chrome 在查看我的给定网页时表现出巨大的延迟。我正在使用 DevTools Performance 选项卡来尝试找到罪魁祸首,我认为罪魁祸首就在我的 JavaScript 代码中的某个地方。 接下来...

回答 2 投票 0

如何在 Ruby 中将 DevTools Network 与 Selenium 4 结合使用

我正在将 Selenium 4 与 Ruby 结合使用,并尝试捕获网络活动,但我不知道如何使用这些库,也没有找到与 Ruby 相关的任何内容。 所以我所做的是...

回答 2 投票 0

Chromium 开发工具(webkit):如何永久显示填充-边距-边框叠加?

当鼠标悬停在 Chromium 中 DOM 列表(“元素”选项卡)中的项目上时,它会在浏览器窗口中显示非常有用的叠加层:边距(橙色)、内边距(绿色)、边框(黄色...

回答 1 投票 0

有没有办法在 Chrome 开发者工具中隐藏盒子模型图形?

我想知道是否有人知道隐藏或删除过滤器上方“计算”选项卡顶部的盒模型图形的方法?它是显示边距/边框/填充和尺寸的图形。我...

回答 1 投票 0

Chrome 119 开发工具:应用程序 > 清除站点数据留下 2GB

我出于开发目的使用 Chrome Beta。在那里,我始终能够使用“开发工具”>“应用程序”>“清除站点数据”来清理本地站点数据。 现在,点击按钮留给我几乎 3GB 的空间...

回答 1 投票 0

Chrome 扩展是否可以使用网站已加载的模块?

我正在开发一个 Chrome 扩展程序,用于自动向网站填充信息。 但是,当我处理这个“flatpickr”元素时,我遇到了一些问题。我试图使用“setDate...

回答 1 投票 0

在 Chrome 开发控制台中仅显示错误

有没有办法在Chrome开发控制台上只显示错误? 现在它显示大约一百万个警告,我必须搜索它们才能找到错误。 谢谢!

回答 5 投票 0

检查在blur 上删除的元素

所以我有一个使用Javascript动态添加到页面的元素。添加后,它就会获得焦点。 我想检查 chrome 开发工具中的元素,但问题是它有一个

回答 9 投票 0

Chrome扩展给出:“未检查的runtime.lastError:无法建立连接。接收端不存在。”

我正在开发一个 chrome 扩展,它将抓取网站并在其内页上执行点击功能。 这是我的文件及其各自的代码: popup.html 文件: 我正在开发一个 Chrome 扩展程序,它将抓取网站并在其内页上执行点击功能。 这是我的文件及其各自的代码: popup.html 文件: <link href="popup.css" rel="stylesheet" type="text/css" /> <script type="module" src="popup.js"></script> <div class="container"> <button class="btnStart" id="btnStart">Start</button> </div> popup.js 文件: import { getActiveTabURL } from "./utils.js"; document.addEventListener("DOMContentLoaded", async () => { const activeTab = await getActiveTabURL(); if (!activeTab.url.includes("example.com")) { const container = document.querySelector(".container"); container.innerHTML = '<div class="title">This is not a example website page.</div>'; return; } else { document.getElementById('btnStart').addEventListener('click', function () { chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { const tabId = tabs[0].id; chrome.tabs.sendMessage(tabId, { action: "BEGIN", message: "BEGIN", urlPath: activeTab.url, tabId: tabId }, function (response) { // Handle the response here if needed console.log("0) outer response in popup.js main script file") console.log(response); chrome.runtime.sendMessage({ tabId: response.tabId, message: "START", urlPath: response.urlPath }, function (inner) { console.log("1) inner response in popup.js main script file") console.log(inner); }); }); }); }); } }); contentScript.js 文件: const tryConnect = () => { chrome.runtime.onMessage.addListener(async (msg, sender, sendResponse) => { if (msg.action === "scrapeAndClick") { console.log("Scraping and Clicking..."); const messageButtonParent = document.querySelector(".profile-action-compose-option"); const messageButton = messageButtonParent ? messageButtonParent.querySelector("button") : null; if (messageButton) { console.log(messageButton.innerText); } else { console.error("Button not found"); } sendResponse({ complete: true, result: "Scrape and click completed" }); } if (msg.action === "BEGIN") { const urlPath = msg.urlPath; const tabId = msg.tabId; const activeTabPageResultsContainer = document.getElementsByClassName("reusable-search__result-container"); let individualResultContainer; let individualProfileContainer; const profileLinks = []; for (var i = 0; i < activeTabPageResultsContainer.length; i++) { individualResultContainer = activeTabPageResultsContainer[i]; individualProfileContainer = individualResultContainer.querySelector('.app-aware-link'); profileLinks.push(individualProfileContainer.getAttribute("href")); } const item = profileLinks[0]; console.log("Profile links collected:", { complete: true, result: "Profile links collected", tabId: tabId, message: "START", urlPath: item }); sendResponse({ complete: true, result: "Profile links collected", tabId: tabId, message: "START", urlPath: item }); } }); }; setTimeout(tryConnect, 1000); background.js 文件: chrome.runtime.onMessage.addListener((obj, sender, sendResponse) => { const message = obj.message; const urlPath = obj.urlPath; if (message === "START") { chrome.tabs.create({ url: urlPath, active: false }, function (tab) { console.log(`new tab created dynamically with id: ${tab.id}`); return new Promise((resolve, reject) => { chrome.tabs.sendMessage(tab.id, { action: "scrapeAndClick", message: "scrapeAndClick", urlPath: urlPath, tabId: tab.id }, function (response) { if (response && response.complete) { console.log(response); // sendResponse(response); resolve(response); } else { console.error('Error in scraping and clicking or response is undefined:', response); reject(response); } }); }); }); // Return true to indicate that sendResponse will be called asynchronously return true; } // Ensure to resolve the promise even if not using it return Promise.resolve(); }); manifest.json 文件包含以下内容: { "name": "Example page scraping", "version": "0.0.1", "description": "Scraping and submitting forms", "permissions": [ "storage", "tabs" ], "host_permissions": [ "https://*.example.com/*" ], "externally_connectable": { "matches": [ "*://*.example.com/*" ] }, "background": { "service_worker": "background.js" }, "content_scripts": [ { "matches": [ "*://*.example.com/*" ], "js": [ "contentScript.js" ] } ], "web_accessible_resources": [ { "resources": [ "assets/icon-16_x_16.png", "assets/icon-24_x_24.png", "assets/icon-32_x_32.png" ], "matches": [ "https://*.example.com/*" ] } ], "action": { "default_icon": { "16": "assets/icon-16_x_16.png", "24": "assets/icon-24_x_24.png", "32": "assets/icon-32_x_32.png" }, "default_title": "Example Scaping and Submission", "default_popup": "popup.html" }, "manifest_version": 3 } 我不断收到以下错误: i) 端口已断开。内容脚本可能无法注入。 ii) “未检查的runtime.lastError:无法建立连接。接收端不存在。” 创建新选项卡,但之后我收到上述错误 我认为你在这里有一个误解,伙计,chrome.runtime.onMessage仅接收通过chrome.runtime.sendMessage方法发送的消息。因此,您的内容脚本中不会收到使用 port.postMessage 从后台发送的消息。同步后台和内容脚本之间的通信方法可能会解决这些问题。需要注意的是,端口连接将在 5 分钟后自动关闭,应予以处理。

回答 1 投票 0

如何防止 Chrome 开发者工具在当前浏览器窗口关闭时关闭?

我正在尝试使用 chrome 开发人员工具来调试 Twitter oauth 遇到的问题。 当 oauth 窗口出现时,我打开开发人员工具来监视请求 - 但一旦...

回答 4 投票 0

如何在 Chrome 开发者工具中延迟脚本/资源加载

有没有办法通过 Chrome 开发者工具为 Google Chrome 浏览器中的脚本/资源加载添加时间延迟?或者完全阻止脚本加载? 我想这样做的原因是...

回答 6 投票 0

即使我在 Chrome 开发者工具中启用它,设备框架也不可见

我看不到任何框架!我尝试禁用并重新启用它,但结果是一样的,顺便说一句,我是新手,也许这是一个愚蠢的问题!对不起。 我已经在所有选项之间切换,但什么也没有

回答 1 投票 0

如何在node.js上类似于chrome/firefox开发者工具来监控网络?

开发客户端 JavaScript 应用程序时,开发人员网络面板对于调试网络问题非常有用: 创建 NodeJS 应用程序的开发人员如何监控网络

回答 10 投票 0

如何从 yotube 视频链接获取 m3u8 播放列表?

过去,我可以在检查网络选项卡时使用 Chrome 开发者工具获取 m3u8 播放列表链接。 我今天试图找到它,但没能找到。我几乎花了一整天的时间尝试...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.