Home jQuery seems to not be loaded when using Chrome Web Console
Reply: 0

jQuery seems to not be loaded when using Chrome Web Console

user3182
1#
user3182 Published in June 20, 2018, 7:41 am

The following script run successfully via the Chrome Web Console for months is suddenly not working.

// Override site's disabling of the console.log function
console.log = console.__proto__.log

// get the DOM ready to process
$(document).ready()
function doThisThing(){
  window._waitWindow = setInterval(function(){

    // start looking for items not 'ready to go'
    items = $("div.Catalogitem-content");
    $.each(items, function(index){

           if($(items[index]).find(".Catalogitem-stager").text().includes("ready to go") || index < lastitemCount){
              $(this).css("background-color", "#84f784");
            } else {
                $(this).css("background-color", "#ff7089");
                $(this).find(".engage-cycle-btn").click();
              }
         });
        window.scrollTo(0, document.body.scrollHeight);
    }, 10000);
  return window._waitWindow;
}

function stopit() {
  clearInterval(window._waitWindow);
  console.log("Just executed clearInterval.");
}

The error thrown is:

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '[object HTMLDocument]' is not a valid selector.

The offending line is:

$(document).ready()

Actions I took:

  1. I checked to see if jQuery had been loaded properly. The results of the following commands led me to believe jQuery wasn't loaded properly... maybe I'm wrong?

Command 1

$(document).ready(function($){ });

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '[object HTMLDocument]' is not a valid selector.

Command 2

console.log($())

null

Command 3

$().jquery

Uncaught TypeError: Cannot read property 'jquery' of null(…)

Command 4

jQuery.jquery

Uncaught ReferenceError: jQuery is not defined(…)

Command 5

$('.class');

null


  1. Tried to load jQuery by running the following code in the Web Browser:

    var jq = document.createElement('script'); jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; document.getElementsByTagName('head')[0].appendChild(jq);

Got this error:

VM711:3 Refused to load the script 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js' because it violates the following Content Security Policy directive: blah blah blah.

Been combing the internet for a solution, but feel I'm in a deep rabbit hole. Is it that jquery's not loaded? Is it that the site I'm processing data from has added a new layer of security to thwart my automation?

I'm at a loss. Thanks in advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.315215 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO