Chrome console clear assignment and variables

A simple solution to this problem is to wrap any code that you don’t want in the global scope in an immediately-invoked function expression (IIFE). All the variables assigned in the function’s scope are deallocated when the function ends: (function() { // Put your code here… })(); For more info on IIFEs: https://en.wikipedia.org/wiki/Immediately-invoked_function_expression [Update] In … Read more

How to open Chrome browser console through Selenium?

To open chrome browser console you can use the ChromeOptions class with –auto-open-devtools-for-tabs argument as follows: Test Configuration: Selenium: Selenium Standalone Server v3.14.0 ChromeDriver: ChromeDriver 2.46.628402 Chrome: Google Chrome 72.0.3626.96 Code Block: import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; public class A_Chrome_Browser_Console { public static void main(String[] args) { System.setProperty(“webdriver.chrome.driver”, “C:\\Utility\\BrowserDrivers\\chromedriver.exe”); ChromeOptions options = new ChromeOptions(); … Read more

Programmatically accessing function scope using Chrome DevTools console

What is the difference between some named object nested directly within a function and some object contained within a Closure in its function scope? The object nested directly with the function is a property of the function object. For example, $.Callback has a .length property with value 1, it does have a .prototype property, it … Read more

Breaking JavaScript execution when cookie is set

Adding this snippet in the beginning of an html → head block works fine: <script type=”text/javascript”> function debugAccess(obj, prop, debugGet){ var origValue = obj[prop]; Object.defineProperty(obj, prop, { get: function () { if ( debugGet ) debugger; return origValue; }, set: function(val) { debugger; return origValue = val; } }); }; debugAccess(document, ‘cookie’); </script> See this … Read more