How to copy cookies in Google Chrome? - google-chrome

Is there any way I can copy/edit the cookies in Chrome Developer tools? Or do I need to install a custom add-on for this?

I think I have found something. I can press Ctrl+A and Drag & Drop the values in a TextBox and then copy it from there.
As pointed by #jmccure,
Ctrl+A, hold Shift and right click and copy.
Update: Chrome 58 added a support to edit cookies

Cross-browser Solution:
Hit F12 or Right-click page and Inspect to open the Developer Tools
Click the Application Tab (which used to be called Resources)
Open Cookies on the left, select your site/domain
Double-click cookie column Value
CTRL/Command + C or Right-click and select Copy

An alternative approach to copy a long cookie value:
Repeat the request with the Network tab open.
Right-click the relevant request (in the list on the left-hand side).
Choose Copy as cURL.
Extract the cookie from the generated Cookie header option.
For example: curl 'http://...' -H 'Cookie: session=...' ...

If you have a lot of cookies and you don't want to install any plugin, I created a small script to avoid copying the cookies one by one.
It was tested only in Google Chrome.
// Open the console in the developer tools
// Tab where you are getting the cookies from
// This block can be just copy and paste
let cookies = document.cookie;
cookies = cookies.split(";");
cookies = cookies.map(cookie => cookie.replace(" ", ""));
copy(cookies);
// Tab where you want to have the cookies
// This block cannot be copy and paste since there is no function to paste
const newCookies = // paste your cookies array here
newCookies.map(newCookie => {
document.cookie = newCookie;
})

This sounds strange, but if you hold Shift and right click, it seems to work most of the time.

I use the Edit this Cookie extension for Google Chrome, which is very nice.
According to its documentation:
EditThisCookie is a cookie manager. You can add, delete, edit, search,
protect and block cookies!

You have to select the value and then you can copy it. Double click helps, but if there are some delimiter characters (e.g. ".", "-" etc.) then you have to triple click it (at least in Windows 10).
So basically:
select the value (double or triple click)
copy the selection (Ctrl+C or "Copy" from context menu)

Unfortunately, there doesn't seem to be any reliable way to do this from developer tools. Right clicking the value and choosing copy sometimes works, but not if there are delimeter characters.
One workaround is to go into the js console and print document.cookie. Unfortunately, that only works for non HTTP_Only cookies.

Another combination that works: Click on cookie value. While holding the left mouse button, click right button thrice. The Copy command will now appear in the shortcut menu.

I wanted to copy my Instagram session to another browser. So I went this way successfully.
On the source browser
Hit F12 / go to Dev Tools
Go to the network tab
Reload the page / hit F5
Scroll up to the very first entry (document http/200)
Click it and go to the headers tab
Find the cookie header and right click / copy value
On the target browser
Go the other browser and hit F12 / go to Dev Tools
Go to the console
Type ''.split(';').forEach(c => document.cookie=c);
Paste your cookie value between the single(!) quotes and hit ENTER
Reload the page / hit F5

Related

Shortcut command for deleting cookies only for current page

I am looking for a command to delete cookies of the currently loaded page in Edge and also in Chrome. For now I only found CTRL + SHIFT + DELETE that shows settings menu where you can delete all the content for all the websites at once. I can delete cookies manually with F12 developer tool, but this is not suitable advice for the user. Any idea?
AFAIK, Edge currently does not have such a shortcut command for deleting cookies of a specific site. For convenience, I suggest pressing this icon beside the address bar.
Then, in the "Cookies" option, you can delete the cookies used for this site.

Is there any short cut key in Chrome Browser to Clear Cache ...? It is difficult to every time go to settings and clear the content

When I develop Wordpress Sites, sometimes cache memory does not get cleared even I hard refresh the page.
Try this:
1) With Chrome open, enter 'ctrl' + 'shift' + 'I' to bring up the developer console.
2) Click on the 'network' tab and then click on the 'Disable cache' checkbox.
Then you should get a fresh copy of the page from the server each time you reload it.
with chrome open - click 'ctrl+shift+delete' to get clear browsing data console.
check only 'cached images and files' then click 'clear browsing data'.
the selection in the console will be remembered so no need to worry about selecting checkboxes again.

Google Developer Tools "Network" Tab clears after redirect

Google Developer Tools "Network" Tab clears after redirect to another page and i want to know if there is any way to keep all request?
I want to do this because i want to verify one POST request but it redirects and get cleared.
In firebug we can use the "Persist" option:
(The "Persist" option prevents clearing the console at a page reload. That means, the messages will stay inside the console as long as this option is enabled.)
https://getfirebug.com/wiki/index.php/Console_Panel
In the network tab of dev tools, on the top left of the dev tools there should be a checkbox labelled Preserve log. Click that and it will preserve network upon navigation.
(older versions may have the record button in the buttom left, as seen here)
Press F8 a couple times until "Paused in debugger" displays. This pauses all JavaScript execution before the reload event. Press F8 again to resume.
The "preserve log" feature mentioned in an answer above is helpful, but each time the page changes (refresh, etc.), the contents of some of the network data tabs are blanked and "Failed to load response data" is displayed. Stopping Javascript execution at the right spot can let you peek at this data before it is erased.

Assign the Shortcut key for Chrome Extension Option page

How can I assign my Google chrome extension option page with shortcut key.
The following works almost as good as a shortcut,
Go to location bar, press Ctrl+L
Type "ce" OR "cs",
Press Enter.
After setting it up as follows,
What I do is, I set them up as search engines on
chrome://settings/searchEngines
Name - Shortcut - URL Chrome Extensions - ce - chrome://extensions/
Name - Shortcut - URL Chrome Settings - cs - chrome://settings/
http://productforums.google.com/forum/#!topic/chrome/hqYtz15LrgQ
Hope this helps!
Currently there is no better way other than injecting content script to all pages with keypress listener. As you would imagine this approach not only isn't very effective, but wouldn't work on some pages (chrome://newtab would be the most annoying one).
Unless assigning a shortcut to your options page is crucial, I wouldn't bother doing it.
I think the options page is meant to be open only from the extension control panel links. However, to solve the shortcut part of the problem you can use the new commands API which will free you from having javascript listeners injected on every page. The shortcuts will work even if you don't have a page loaded in your tab.
You could use this autohotkey script:
#IfWinActive, ahk_class Chrome_WidgetWin_1 ; Shortcut functions only on Chrome
^q::Send, ^t chrome://extensions/ {enter} ; functioning script
#IfWinActive
The second line is the script and means that if you press Ctrl+q (^ stays for Crtl) the script opens a new Tab (Ctrl+t), type the address (chrome://extensions/) and press enter.
You can change the shortcut key changing what is before the ::.
Then I suggest you to put the file .exe in the startup folder.

How to remove all breakpoints in one step in Google Chrome?

How to remove all breakpoints in one step in Google Chrome? Using version 11.
[update]
There is now a feature request for this.
[update]
The feature request is closed (Dec 2011)!
This is now possible in Sources tab of Chrome Developer Tools.
Please see screen grab below and right click within the "Breakpoints" section of the left window.
Since recently (Chrome 18), you can right-click any breakpoint in the Breakpoints pane and voila! The "Remove All JavaScript Breakpoints" popup menu item!
Chrome Devtools crashed everytime I tried to access the Sources panel because of a breakpoint on a minified Javascript file.
To remove all breakpoints without access to the interface, you can do the following:
Open inspector-on-inspector : undock first inspector and hit ctrl+shift+i to open the second
On the inspector-on-inspector console, execute the following:
window.localStorage.breakpoints = [];
Close the inspectors and reload the page. Now the breakpoints are gone.
Under Sources, you can click button marked with red on picture below or use shortcut Ctrl + F8 just like tool tip is showing (activate / deactivate breakpoints). A little bit lower under 'Breakpoints' you will see all your breakpoints. If you choose to disable all, they will be grayed out.
solution here.
To purge all breakpoints open inspector on inspector (undock first
inspector and hit ctrl-shift-I to open the second) and run
"WebInspector.settings.domBreakpoints.set([])" in second inspector's
console.
new Tabs; Ctrl+Shift+J to Console; Access URL
Open the Chrome task manager and end the tab page.
Ctrl+Shift+J to Application -> Service Workers (Offiline) -> Refresh
to Sources Cancel Breakpoint
Success
Another option is to de-activate all break points using:
Ctrl + F8
In my case Uninstall and new installation of Chrome was without any success.
Also window.localStorage.clear() did not help.
My "last chance solution" is to remove entire directory where Chrome is storing its data.
First turn off your Chrome.
Then look at this path "c:\Users\ {your_user} \AppData\Local\Google\Chrome\User Data\Default\Local Storage\". Here try to delete all what is in this directory.
You can also clear all inspector settings and reload the inspector. It helped me with fantom breakpoint I could not remove in any other way. Open inspector and go to Preferences -> Sync -> Restore defaults and reload (at the bottom).
Step 1: Go to Developer tools and expand Breakpoint section
Step 2: Right click on expanded area of breakpint and there will be many options lik