Record user actions in Chrome Devtools: Possible? - javascript

I'm looking for a way to record every thing I do in Chrome Devtools so I can play it back verbatim. I've seen a lot of docs on how to manipulate page content, track page performance and behavior etc from devtools extensions, but nothing yet about actually watching what I do in Chrome Devtools itself. I'd be willing to write an extension if that's what needed. The goal is a teaching tool where I can record things I'm doing in devtools and play them back. (Of course, one could use a GIF recorder but that's so 00's). Something I've looked a little bit at so far is chrome devtools protocol viewer but not sure if it could accomplish the task.
Can anybody suggest a potential way to accomplish this? Thanks in advance!

Now Chrome has an inbuilt recorder tool available in the Dev Tools. Much better than installing any 3rd party extension. Additionally, there are many more features to track the user journey.
Recorder in Chrome Dev Tools

You may try using Desktop Capture API which can be used to capture content of screen, individual windows or tabs. Here's a demo app that shows you how to use a Chrome extension to access the desktopCapture API in your web-application. Additional reference which might help: In chrome extensions, is there a way to record screen without ssl?

Related

adding functionality to chrome developer tools

I'd like to add functionality to chrome's developer tools.
In particular it would be nice to have a most used files option to the list of scripts I'm looking at. Also would be nice to hide some scripts from my list that im not currently interested in.
Any guidance on where to start would be appreciated ? e.g. is this something possible with an addon or is it core chrome functionality ie is this a patch to the chrome source ?
There is a small guide about extending Chrome DevTools.
http://smus.com/extending-chrome-developer-tools
The guide about hacking the DevTools is here http://code.google.com/chrome/devtools/docs/contributing.html
Chrome doesn't currently allow messing with the developer tools. There is an experimental chrome.experimental.devtools API however that allows you to add your own pages to the devtools. Experimental APIs needs to be enabled on chrome://flags, otherwise extensions using them won't install. And of course you cannot upload such extensions to the Chrome Web Store. If that's ok for you then you can try to implement something. Eventually these APIs will be marked as stable but I have no idea when this will be.

How to make a firefox addon that acts as an offline website

What I want to do is that when the user clicks a button I will add to firefox (or clicks an option I will add under tools, etc), a new tab should be opened, and in the tab will essentially be an offline website that is written in HTML/CSS/JS and will be part of the addon.
How can I do this? It does not matter to me if I require a very new version of firefox to accomplish this.
Making your first firefox addon can be quite challenging, at first. But once you make one, things get much better. Here are some tools to help you get started:
https://addons.mozilla.org/en-US/developers/tools/builder
I suggest you start with this and check all the features. Once you download the skeleton, look over ff-overlay.xul in the /chrome/content folder. It should be straightforward if you know XUL/Javascript.
https://developer.mozilla.org/en/Setting_up_extension_development_environment
This link helps you set up Firefox for easy addon testing and debugging.
https://developer.mozilla.org/en/Code_snippets/Tabbed_browser
The Mozilla Developer Network is incredibly useful. For example, that link takes you to a page that explains everything about switching tabs.
https://builder.addons.mozilla.org/
Addon playground.
Remember, Google's your friend! Good luck!

Finding bottlenecks in javascript?

I'm attempting to find a bottleneck in my Javascript. Basically I'm developing a chrome extension written in Javascript which is taking 4-5 seconds to perform a task. There's a lot of code involved in the task and using print statements / chrome built in dev tools just isnt working. The dev tools don't seem to even see my Javascript running. I'm wondering if anyone has any advice / tools they think could be of benefit?
Open your page in Chrome.
Tools -> Developer tools -> Profiles
Start Profiling (3rd button, grey circle on the status bar at the bottom)
Perhaps it'd be a good idea to open the HTML files in Firefox instead of letting Chrome extensions handle it. That'd allow you to use Firebug to determine any causes, which would be very helpful.
I remember Google Chrome has a built-in JavaScript profiler. Or can't you use this for your extension? (I have never built Chrome extensions.)
You can try to use Profiler as it was mentioned before or Timeline.
Timeline will help you if the time was spent in native code.

How to suppress javascript errors for sites I'm not developing?

I like to keep javascript debugging enabled in my browser so when I'm developing my own code I can instantly see when I've made an error.
Of course this means I see errors on apple.com, microsoft.com, stackoverflow.com, cnn.com, facebook.com. Its quite fun sometimes to see just how much awful code there is out there being run by major sites but sometimes it gets really annoyed.
I've wondered for YEARS how to change this but never really got around to it. Its particularly annoying today and I'd really like to know of any solutions.
The only solution I have is : use a different browser for everyday browsing.
I'm hopin theres some quick and easy plugin someone can direct me to where I can toggle it on and off based upon the domain i'm on.
Edit: I generally use IE7 for everyday browsing
Firebug lets you enable/disable debugging for different domains.
Script Debugging in IE7 is controlled by a registry key. (An addon could probably toggle it. I just don't know of any.)
So, how I handle this is to write a registry script to turn it on or off. Then, I put a link to those scripts on my windows quick-launch bar and change their icons to be more appropriate. Then, I can just click one of the links to turn on or off IE script debugging.
Turn Off:
REGEDIT4
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Disable Script Debugger"="yes"
"DisableScriptDebuggerIE"="yes"
Turn ON:
REGEDIT4
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Disable Script Debugger"="no"
"DisableScriptDebuggerIE"="no"
Firefox lets you use different profiles. Each profile can have separate preferences, themes and plugins. Start firefox on Windows this way: firefox.exe -ProfileManager to create or manage profiles.
I use Firefox and Webkit for web debugging and Safari for regular web browsing, however. Firefox is just better for web development, and I prefer Safari overall.
I keep those annoying popups on for Internet Explorer, and you're right. It's amazing how few developers ever bother testing their code in IE. As a web developer, it's sorta your duty, right? Seeing as how it still accounts for like 60% of traffic to most sites.
Anyway, in answer to your question, I simply switched to Chrome for everyday browsing, and only use IE for testing and developing.
You have two options.
Change and use a browser that allows you to have site specific configuration (check out Firefox with Firebug), or
Use different browsers for developing and everyday use.
CompanionJS doesn't let you toggle debugging on a domain basis, but makes the error messages less obtrusive for casual surfing, and makes script debugging in general more user friendly.
Chrome doesnt bug you unless you first open the javascript debugger window
If you want to test and debug JavaScript, Firefox and Firebug are unrivalled in terms of features and ease of use. Chrome is not as powerful as Firebug, no matter what anyone else tells you.

JavaScript Troubleshooting Tools in Internet Explorer

I use Firebug and the Mozilla JS console heavily, but every now and then I run into an IE-only JavaScript bug, which is really hard to locate (ex: error on line 724, when the source HTML only has 200 lines).
I would love to have a lightweight JS tool (a la firebug) for Internet Explorer, something I can install in seconds on a client's PC if I run into an error and then uninstall. Some Microsoft tools take some serious download and configuration time.
Any ideas?
You might find Firebug Lite useful for that.
Its bookmarklet should be especially useful when debugging on a user's machine.
Since Internet Explorer 8, IE has been shipping with a pretty impressive set of tools for JavaScript debugging, profiling, and more. Like most other browsers, the developer tools are accessible by pressing F12 on your keyboard.
Script Tab
The Script tab is likely what you'll be interested in, though the Console, Profiler, and Network tabs get plenty of use as well while debugging applications.
From the Script tab you can:
Format JavaScript to make it more readable
Move from source to source of various resources on the page
Insert breakpoints
Move in and over lines of code while stepping through its execution
Watch variables
Inspect the call stack to see how code was executed
Toggle breakpoints
and more...
Console Tab
The console tab is great for when you need to execute some arbitrary code against the application. I use this to check the return of certain methods, or even to quickly test solutions for answers on Stack Overflow.
Profiler Tab
The profile is awesome if you're looking for long-running processes, or trying to optimize your code to run smoother or make fewer calls to resource-intensive methods. Open up any page and click "Start profiling" from the Profiler tab to start recording.
While the profiler is working, you can move about the page, performing common actions. When you feel you've recorded enough, hit "Stop profiling." You will then be shown a summary of all functions ran, or a call tree. You can quickly sort this data by various columns:
Network Tab
The network tab will record traffic on your site/application. It's very handy for finding files that aren't being downloaded, hanging, or for tracking data that is being requested asynchronously.
Within this tab you can also move between a Summary view and a Detailed view. Within the Detailed view you can inspect headers sent with requests, and responses. You can view cookie information, check the timing of events, and more.
I'm not really doing the IE Developer Tools justice - there is a lot of uncovered ground. I would encourage you to check them out though, and make them a part of your development.
I would recommend Companion JS.
This is the free version of Debug Bar but I find it easier to use and have the features I need. Great to test little JavaScript snippets in IE the same way I do with Firebug in Firefox.
EDIT 5 years later: I now uses Internet Explorer integrated developer tools.
IE 8 is supposed to have better tools, but the IE Developer Toolbar is pretty good.
I use both Microsoft Script Debugger and FireBug Lite, depending on what I am debugging. Both are great tools- try them both out and stich with what you're comfortable with.
In IE8 just press F12!
Go to Tools->Internet Options…->Advanced->Enable Script Debugging (Internet Explorer)
then attach Visual Studio Debugger when an error occurs.
If you're using IE 8, install the developer toolbar because it has a built in debugger.

Categories