Switching between browser windows is different than switching b / w tabs.
In some cases, the browser window handler command may work, but it will not work in all browsers.
Here is the b / w tab navigation solution
to navigate from left to right:
Actions action= new Actions(driver); action.keyDown(Keys.CONTROL).sendKeys(Keys.TAB).build().perform();
To navigate from right to left:
Actions action= new Actions(driver); action.keyDown(Keys.CONTROL).keyDown(Keys.SHIFT).sendKeys(Keys.TAB).build().perform();
source share