Frage

I am working with the ChromeDriver and I am successfully able to launch the browser and load pages using getUrl(). I followed the steps mentioned here: http://code.google.com/p/selenium/wiki/ChromeDriver and everything works fine. However, when I try to get the size of the browser window, I get a NullPointerExpception in the code:

ChromeDriver driver = new ChromeDriver();
Dimension size = driver.manage().window().getSize();

I also checked that "driver.manage().window()" returns a "RemoteWindow" object and is not null. Other calls like getPosition() also throw a null pointer expception:

Caused by: java.lang.NullPointerException
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.getSize(RemoteWebDriver.java:595)

Or:

Caused by: java.lang.NullPointerException
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.getPosition(RemoteWebDriver.java:607)

Has anyone else seen similar issues with ChromeDriver? Any solution or ideas would be highly appreciated.

Thanks!

War es hilfreich?

Lösung

The manage().window() API is relatively new to WebDriver and as such it has not been implemented in Chrome yet.

You can follow this issue for updates: http://code.google.com/p/selenium/issues/detail?id=174

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top