Skip to content

BUG: Cannot Resize Window when ChromeDriver is running in incognito mode #1895

@JasonSmiley208

Description

@JasonSmiley208

Meta -

OS: Mac El Capitan -10.11.4
Selenium Version: 2.53.0
Browser: Google ChromeDriver 2.21
Browser Version: 49.0.2623.87 is the installed Chrome browser on my computer

My Pom.xml:

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.0</version>
    </dependency>

Expected Behavior -

I should be able to resize a chrome window when its running in incognito mode.

Actual Behavior -

After starting the browser, an exception is thrown when I try to resize().

Note, if you remove the adding of the options to the desired capabilities, the code will work just fine (resizes correctly when not in incognito mode).

Steps to reproduce -

(In Java)

        //Build Active Driver
        ChromeOptions options = new ChromeOptions();
                options.addArguments("-incognito");
        LoggingPreferences loggingprefs = new LoggingPreferences();
        loggingprefs.enable(LogType.BROWSER, Level.ALL);
                DesiredCapabilities capabilities = DesiredCapabilities.chrome();
                capabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingprefs);      //Setup Logging
                capabilities.setCapability(ChromeOptions.CAPABILITY, options);

                //Sets up Chrome for local usage.
                System.setProperty("webdriver.chrome.driver",  System.getProperty("user.dir") + "/chromedriver");

                driver = new ChromeDriver(capabilities);

        //Sets Script timeout to 5 seconds. Used for Synthetic Actions (executing of Javascript)
        driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS);

        //Set default Explicit wait times to default wait time (currently 30 seconds instead of 10).
        waiter = new WebDriverWait(driver, defaultTimeOutInSeconds);

        //Ignore StaleElementReferenceExceptions while waiting in addition to the NotFoundException.
        waiter.ignoring(StaleElementReferenceException.class);

        //Create Javascript Executor object for directly executing Javascript in the browser.
        js = (JavascriptExecutor) driver;

        //Sets browser window size to 1280x1024
        driver.manage().window().setSize(new Dimension(1280, 1024)); //Fails Here

When executing the last line, I get the following stack trace:

org.openqa.selenium.WebDriverException: unknown error: No current window
JavaScript stack:
Error: No current window
at checkForExtensionError (chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:14:17)
at Object.callback (chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/background.js:67:5)
at safeCallbackApply (extensions::sendRequest:21:15)
at handleResponse (extensions::sendRequest:72:7)
(Session info: chrome=49.0.2623.110)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.11.4 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 148 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'MacBook-Pro.local', ip: '10.0.21.150', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=/var/folders/_3/1bmspbg951b41lnrh70jp8_c0000gn/T/.org.chromium.Chromium.1700q1}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=49.0.2623.110, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 3f4e4ad8de0c282b79e73e39699caec1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.setSize(RemoteWebDriver.java:891)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions