Set capability on already running selenium webdriver

Capabilities are no longer editable once the browser is launched.
One way to temporary disable the waiting is to implement your own get with a script injection.

Something like this:

// loads the page and stops the loading without exception after 2 sec if 
// the page is still loading.

load(driver, "", 2000); 
public static void load(WebDriver driver, String url, int timeout) {
    "var url = arguments[0], timeout = arguments[1];"
    "window.setTimeout(function(){window.location.href = url}, 1);" +
    "var timer = window.setTimeout(window.stop, timeout);" +
    "window.onload = function(){window.clearTimeout(timer)}; "
    , url, timeout);

Leave a Comment