标签: google-chrome-devtools

找出内联css的来源

我有一个元素从一些js函数接收内联样式.我发现了这个功能.但是想问一下,有没有办法找出哪种函数放入内联样式?(在"计算"选项卡中,我看到所有影响此元素的css文件,但内联样式标题为"element.style",还有其他方法吗?

css google-chrome-devtools

0
推荐指数
1
解决办法
1800
查看次数

如何注销和删除旧服务人员?

我已经使用.register注册了一个服务woker,可以在开发工具的“应用程序”选项卡中看到。现在我的问题是如何注销此服务工作者。

我已经运行了这个脚本

if ('serviceWorker' in navigator) {
        window.addEventListener('load', function() {
                console.group('====SW registration=======');
                navigator.serviceWorker.register('/sw.js', {scope: './'}).then(function(registration) {
                    console.log('SW registratered successfully');
                    console.log(registration);
                    registration.unregister().then(function(result) {
                        console.log('Unregistered done', result);
                    });
                }).catch(function(error){
                    console.error('sw registration failed', error);
                });
                console.groupEnd();
        });
}
Run Code Online (Sandbox Code Playgroud)

但是我看到这样做,实际上是在先注册服务工作者,然后再取消注册。这对我来说似乎不是正确的方法。

或者,我可以从开发工具“ 应用程序”>“服务工作者”中单击服务工作者附近的注销链接,还可以单击“ 应用程序”>“清除存储”,然后在新选项卡中重新打开URL。

但是当我通过chrome:// serviceworker-internals /查看时

它在列表的底部显示旧的和未注册的服务人员的列表(参见图片)

未注册的软件

那么,为什么在这里看到冗余服务人员列表?什么时候更新?这是chrome浏览器的默认行为吗?

google-chrome-devtools service-worker

0
推荐指数
1
解决办法
3867
查看次数

在开发工具中检查之前无法选择元素

令人着迷的情况。

\n\n

我试图通过类名选择元素,只需在 Chrome 开发工具控制台中输入即可。我可以看到我想要选择的元素,并且它们在页面上可见。我等待 3 秒多的时间来加载页面,然后直接进入开发控制台并输入:

\n\n
document.getElementsByClassName("example");\n>> HTMLCollection\xc2\xa0[]\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后,我右键单击有问题的元素并点击“检查”。然后我返回控制台并输入:

\n\n
document.getElementsByClassName("example");\n>> HTMLCollection\xc2\xa0[div.example.row]\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以现在元素就在那里!但在检查元素时,除了将鼠标悬停在元素上之外,我没有在开发工具中执行任何操作。有人能帮忙解释一下这个谜团吗?非常感谢。

\n\n

如果有任何解释,我正在使用Quovo。这是一个演示: https: //youtu.be/lPcIYupa2kY

\n

javascript dom google-chrome-devtools

0
推荐指数
1
解决办法
2009
查看次数

Puppeteer:在选择器中转义方括号

我需要选择 ID 包含方括号的元素。

IE

#element[0]
Run Code Online (Sandbox Code Playgroud)

但是,我不断收到:

错误:未能找到与选择器“element[0]”匹配的元素

我已经用 转义了选择器中的元素\,但这不起作用。

page.select("#fruit\[0\]", "apples")
Run Code Online (Sandbox Code Playgroud)

双反斜杠转义也不起作用。IE:

page.select("#fruit\\[0\\]", "apples")
Run Code Online (Sandbox Code Playgroud)

更新:我试图选择的元素:

<select id="fruit[0]">
  <option>Please make a selection</option>
  <option>apples</option>
</select>
Run Code Online (Sandbox Code Playgroud)

注意:即使我尝试在上面的查询中使用 page.waitFor 方法,我也会遇到同样的错误。

javascript google-chrome-devtools google-cloud-functions puppeteer

0
推荐指数
1
解决办法
1266
查看次数

有没有办法在 Chrome DevTools 中重新分配常量?

我知道一个const值并不意味着要重新分配,但是考虑到 DevTools 是为了在调试时调整值,我认为应该有一种快速的方法来尝试值。让我们说app.js

const foo = 5;

在控制台中,我尝试在控制台中重新分配它 foo = 6;

显然它不起作用(分配给常量变量)。我也尝试过,delete(window.foo)但即使delete函数返回 true,该值仍然存在。

目前的解决方法是使用本地覆盖(并且必须设置持久文件系统),因为实时编辑不起作用(该值已经存在并且没有本地覆盖,已编辑的值在重新加载后无法保存)。

有没有更简单的方法来快速更改const值?

javascript google-chrome constants google-chrome-devtools

0
推荐指数
1
解决办法
1352
查看次数

无法在 Selenium C# 中获取 Chrome 性能日志

我在我的解决方案中使用以下 nuget 包

  1. Selenium.WebDriver - v3.141.0
  2. Selenium.WebDriver.ChromeDriver - v79.0.3945.3600

使用以下代码我正在创建一个 Chrome 驱动程序实例

ChromeOptions options = new ChromeOptions();

//Get Performance Logs from Network tab
ChromePerformanceLoggingPreferences perfLogPrefs = new ChromePerformanceLoggingPreferences();
options.PerformanceLoggingPreferences = perfLogPrefs;
options.SetLoggingPreference("performance", LogLevel.All);
Run Code Online (Sandbox Code Playgroud)

(或者)

ChromePerformanceLoggingPreferences perfLogPrefs = new 
ChromePerformanceLoggingPreferences();
perfLogPrefs.AddTracingCategories(new string[] { "devtools.timeline" });
options.PerformanceLoggingPreferences = perfLogPrefs;
options.SetLoggingPreference("goog:loggingPrefs", LogLevel.All);
options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
Run Code Online (Sandbox Code Playgroud)

并与此相结合

options.AddUserProfilePreference("intl.accept_languages", "en-US");
options.AddUserProfilePreference("disable-popup-blocking", "true");
options.AddArgument("test-type");
options.AddArgument("--disable-gpu");
options.AddArgument("no-sandbox");
options.AddArgument("start-maximized");
options.LeaveBrowserRunning = true;

IWebDriver driver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)

但是在创建 Chrome 驱动程序实例时,我收到以下错误消息

无效参数:“firstMatch”的条目 0 因无效参数而无效:指定了 perfLoggingPrefs,但未启用性能日志记录

我可以知道我需要进行哪些更改才能获取最新版本的 Chrome 和 Selenium …

c# selenium google-chrome-devtools selenium-chromedriver selenium-webdriver

0
推荐指数
1
解决办法
2842
查看次数

如何在 python 中制作 chrome 扩展?

我已经浏览过论坛,但所有解决方案都很旧,并且某些软件包已被弃用。

我想创建 chrome 扩展并使用 python 包,如 scipy、正则表达式和抓取库。

我是一名 python 开发人员,不懂 javascript。

有什么方法可以完全创建 chrome 扩展或大部分在 python 中使用?

python google-chrome-extension google-chrome-devtools

0
推荐指数
1
解决办法
4255
查看次数

Node.js 与 Chrome 中的 JavaScript 对象占用多少内存?

我不明白为什么堆大小是应有的两倍。

\n

我创建了一个完美的二叉树。我猜 v8 知道每个节点有 3 个字段。

\n
function buildTree(depth) {\n  if (depth === 0) return null;\n\n  return {\n    value: 0,\n    left: buildTree(depth - 1),\n    right: buildTree(depth - 1),\n  };\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我假设 1 个数字占用 8 个字节,2 个对象引用各占用 8 个字节。因此,一个树节点总共占用 24 个字节。

\n

然后我运行下面的代码:

\n
const tree = buildTree(25);\n// 2 ** 25 - 1 \xe2\x89\x88 33_500_000 nodes\n// 33_500_000 nodes \xc3\x97 24 bytes = 840_000_000 bytes\n\nconst { heapUsed } = process.memoryUsage();\nconst expectedSize = (N * 24 / 1e6).toFixed(2) + " MB";\nconst actualSize …
Run Code Online (Sandbox Code Playgroud)

javascript v8 heap-memory google-chrome-devtools

0
推荐指数
1
解决办法
136
查看次数

如何更改网站JavaScript代码中的变量值?

如何更改网站JavaScript代码中的变量值?

我想知道,因为我现在正在建立一个网站,作为代码的一部分,我有一个变量,其价值对网站的功能有重要影响.因此,我希望知道某人如何能够改变这一价值(即使它只影响该用户所看到的网站).

我对学习如何在Google Chrome中执行此操作特别感兴趣.

javascript debugging google-chrome breakpoints google-chrome-devtools

-1
推荐指数
1
解决办法
2347
查看次数

谷歌Chrome开发工具:填充与保证金

有人可以解释为什么填充和边距使Google Chrome开发工具报告内容的宽度不同.

这是一个例子:

HTML

<div class="box">
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

// Dev Tools reports the DIV has a width of 320px
.box {
  padding: 10px;
}

// BUT here Dev Tools reports the DIV has a width of 300px
.box {
  margin: 10px;
}
Run Code Online (Sandbox Code Playgroud)

html css google-chrome-devtools

-2
推荐指数
1
解决办法
399
查看次数