google-chrome-devtools

How to toggle Device Mode on a popup window in Chrome?

Deadly 提交于 2019-12-02 04:20:37
问题 I have a web app with a chat that opens in a new popup window. Normally, in Chrome I can hit F12 and click the icon of a smart phone to toggle it. But in the popup window this icon does not appear. This is important for me since I need to throttle the connection of the popup in order to simulate a user disconnecting from the chat. Thanks! 回答1: It doesn't seem to be currently possible. I've opened a ticket for you. Meanwhile you have couple of options: open popup in a regular window (copy

Hide fetch errors [duplicate]

与世无争的帅哥 提交于 2019-12-02 04:16:59
This question already has an answer here: Suppress Chrome 'Failed to load resource' messages in console 3 answers I've noticed that Chrome is logging all 4xx errors met by fetch while other browsers (at least Safari and Chrome) do not log them. How can I prevent Chrome fetch from logging to console http request errors like 400 and 422? You can use the "Hide network messages" option to hide these in the Console. You will still be able to see the error in the Network tab. Before After If you want to filter particular error codes, you could use a regular expression to do this. The following

chrome.webRequest redirectUrl with URL Saved in chrome.storage.local

三世轮回 提交于 2019-12-02 03:19:15
I'm trying to intercept web requests and redirect them to a url I have saved on local storage but it isn't working. My code is as follows: chrome.webRequest.onBeforeRequest.addListener( function (details) { if (details.url === 'http://myapp.com/theurl') { chrome.storage.local.get("http://myapp.com/theurl", function (result) { return { redirectUrl: result.savedUrl }; //savedUrl property is the modified Url }); } }, { urls: ["<all_urls>"] }, ["blocking"]); Hardcoding the return statement/url works: chrome.webRequest.onBeforeRequest.addListener( function (details) { if (details.url === 'http:/

Chrome Developer tools: How to disable code auto complete?

两盒软妹~` 提交于 2019-12-02 03:06:19
问题 I am experimenting with Chrome DevTool's beautiful Workspaces / in-devtools code editor in the source panel, set up roughly like the accepted answer here: Chrome developer tools: View Console and Sources views in separate views/vertically tiled? So far, it's awesome. The one drawback is that I detest code completion dropdowns and the browser entering things for me. When it gives me two quotes and I've only typed one, I really get irritated. Anyway, is there a way to stop it automatically

What's the meaning of the numbers printed below the message of console.log?

£可爱£侵袭症+ 提交于 2019-12-02 02:42:00
I'm doing some testing in chrome debugger tool, I find some strange numbers are printed below the texts output by console.log: I didn't log in the console, why are they there? what are these numbers? what does it mean? The Chrome console logs the value of the last expression executed. In the first example above, the last line, i++; logs 9 . In the second example, i+=1; logs 10 . 来源: https://stackoverflow.com/questions/33604144/whats-the-meaning-of-the-numbers-printed-below-the-message-of-console-log

Selenium Duplicate Elements marked with ==$0

旧巷老猫 提交于 2019-12-02 02:30:32
How to handle duplicate elements in selenium, where duplicate elements comes marked with ==$0 ? Go to www.google.com and search for google search button, I have tried iterator and creating list, but, is this correct way of handling ==$0 driver.findElements(By.xpath("//input[@aria-label='Google Search']")); I want to select second element. $0 - $4 The $0 , $1 , $2 , $3 and $4 are the historical reference to the last five DOM elements inspected within the Elements panel of google-chrome-devtools or the last five JavaScript heap objects selected in the Profiles panel. $0 returns the most recently

Hide fetch errors [duplicate]

谁说我不能喝 提交于 2019-12-02 01:56:46
问题 This question already has answers here : Suppress Chrome 'Failed to load resource' messages in console (3 answers) Closed last year . I've noticed that Chrome is logging all 4xx errors met by fetch while other browsers (at least Safari and Chrome) do not log them. How can I prevent Chrome fetch from logging to console http request errors like 400 and 422? 回答1: You can use the "Hide network messages" option to hide these in the Console. You will still be able to see the error in the Network

puppeteer: Access JSON response of a specific request as in the network tab of DevTools

穿精又带淫゛_ 提交于 2019-12-02 01:47:27
问题 I'd like to directly get the response of the last HTTP request shown in the screenshot. The current puppeteer code is shown below. Could anybody show me how to modify it so that it will get the JSON response directly from the browser? Thanks. const puppeteer = require('puppeteer'); (async () => { // const browser = await puppeteer.launch(); const browser = await puppeteer.launch({ headless: false , args: ['--user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML

Save html locally from Devtools

扶醉桌前 提交于 2019-12-02 01:35:04
问题 I am using Emmet Livestyle with Chrome and Sublime text editor. I am editing my files locally and can update my css and js from the devtools so that those changes are reflected at the same time in my local files too. But how can I update my html code too? 回答1: We cannot persist HTML edits back. Because, well, you aren't editing HTML. Here is what is going on... The server sends Chrome the page (HTML.) This is taken, tokenized, then a DOM (Document Object Model) is constructed out of it. The

Is there a way to print out the line number of a js file in the console log

邮差的信 提交于 2019-12-02 00:57:14
问题 For debugging purposes, I usually use something like console.log('line number #') . Not sure if it's the best way to handle it but I think it would be helpful if I can just print out the line number of the line where I'm putting the console.log() dynamically . Let's say: 1 //do something 2 if(file){ 3 console.log('Line 3'); 4 $('#uploads').css({ 'height' : 'auto' }); 5 } else { 6 console.log(getLineNumber()); //just an example 7 $('#tags').val(temp); 8 } In the above, if I happen to remove