The executeScript command in Selenium can be used to run JavaScript instructions. The command window. stop() is supplied as an argument to the executeScript method to stop a page from loading. In addition, for the Chrome browser, we must set the pageLoadStrategy to none and wait for the web element to load.