I am going to make wild guess:
Try to initialize your driver like this:
WebDriver driver = new FirefoxDriver(); //assume you use firefox
The interface WebDriver
supports that method. Do not forget to store the handle somewhere ;)
String myWindow = driver.getWindowHandle();
BTW that method should return you actual window If you need all windows you probably should use getWindowHandles()
method
If this does not work, please provide more info:
- what error exactly are you getting?
- How do you initialize WebDriver?
- What version of selenium are you using?|
- What type of driver are you using?