Skip to content

Instantly share code, notes, and snippets.

View RByers's full-sized avatar

Rick Byers RByers

View GitHub Profile
@RByers
RByers / flipkart-android.har
Created April 27, 2016 01:44
HAR showing resources fetched when loading mobile version of flipkart.com on Chrome 50
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
"startedDateTime": "2016-04-27T01:42:01.485Z",
(function(){
function getElementXPath(element) {
if (element && element.id)
return '//*[@id="' + element.id + '"]';
else
return getElementTreeXPath(element);
}
function getElementTreeXPath(element) {
var paths = [];
(function(){
// Override function in given prototype to add a log statement
function logMethod(prototype, fname) {
if (!(fname in prototype)) {
console.warn("Warning: can't instrument " + prototype.constructor.name + '.' + fname);
return;
}
var original = prototype[fname];
prototype[fname] = function() {
@RByers
RByers / Logging programattic scrolls
Last active August 15, 2017 10:34 — forked from majido/detectProgrammaticScroll.js
Script to be pasted into developer tools to log calls to programmatic scrolling APIs. Currently tested just on Chrome and Firefox.
(function(){
// Override function in given prototype to add a log statement
function logMethod(prototype, fname) {
var name = prototype.constructor.name + '.' + fname;
if (!(fname in prototype)) {
console.warn("Warning: can't instrument " + name);
return;
}
console.log("Instrumenting " + name);
var original = prototype[fname];