I am trying to use Selenium Webdriver (JavaScript Version) and a Chrome Extension to capture network traffic and look for traffic to a specific pattered url. I'm trying to save the matching traffic to a new variable in the window object to simplify testing later.
I can modify the window following the answer here but for some reason I cannot create a new global variable, so when I open the console and type in "window.testing" after the page load it returns undefined.
Content script code snippet:
window.addEventListener('load', loadEvent => {
    let window = loadEvent.currentTarget;
    //Works as expected
    window.document.title='You changed me!';
    window.testing = {test: '123'};
    testing.customlog = 'You made a custom log!';
    // Console logs as expected
    console.log(testing);
    // Gives error - undefined
    console.log(window.testing);
});
 
     
     
    