0

I use the Chrome developer console a lot while I'm testing websites, and one thing I pass a bunch is specific ID numbers that I would like to jot down.

Right now I'm looking into easy ways to be able to access these ID numbers after I've already passed them. I know I can make the log persist after navigating to other windows, but that keeps all of the data and I don't want the rest of the stuff.

I've also looked into saving the console log and using console.log(document.getElementById("").value); to put the value into the console, but then I found out that the log is reset after every new session.

I would like to know where to get started for something like this. Is there some way to write the values to a file through a Chrome extension? Alternatively, is there a console setting or a function I could use to keep all of the values in the console so I could copy them all at once without having all of the other console text in there?

Thanks

Edit- More Information:

I'm testing from the user side, and using both commands manually entered into the Chrome console and a locally-hosted Chrome Extension for filling out select pages by editing the values of inputs.

The exact scenario is that I go to a page where I enter address information, and at the top of the page is a number with an element ID, let's just say userId. I click my Chrome Extension and it enters in all the address information and progresses to the next page. I also have a saved script for JavaScript that I can copy and paste into the console to fill out all the information.

With this much control, I want to be able to save the userId value, at the very least to an array in the console that I can paste to get all of the userId's that I've passed before.

Junior Dev
  • 114
  • 10
  • It's unclear what your specific scenario is? Do you have javascript code running in these websites? In a browser extension? Manually typed commands in the debuggger? Who's putting the info into the console? What kind of code it is determines which options you have for saving the data somewhere. – jfriend00 Oct 14 '14 at 22:25

2 Answers2

0

I think that HTML5 Local Storage is a good way to store persistent data in your browser, relative to your website. Look into this http://www.w3schools.com/html/html5_webstorage.asp

Basically, if you want to save an id, relative to a page, you open the console in that page and simply type localStorage.id = "<your_id>" and then you could retrieve that data just by typing localStorage.id in the console

amine
  • 502
  • 5
  • 14
  • localStorage and chrome.storage turned out to be my best options. It's not the easiest API to work with, and my main problem is creating either a way to hold an array of them that continues to cycle as I use add or one that can let me call it when needed. This was a good starting point though, thanks. – Junior Dev Oct 22 '14 at 00:07
0

You can do this by capturing the output of Chrome itself. Please see this question for details.

Community
  • 1
  • 1
Tim Jansen
  • 3,330
  • 2
  • 23
  • 28