I am trying to automate a test case using Java, Selenium and Chrome Driver but I have not been able to navigate to the newly opened tab. I can see that the page opens but Selenium's focus does not move to the new tab.
I have tried a number of things: each of these points were tried on their own
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN);
element = driver.switch_to_window(element.driver.window_handles[1]);
element.sendKeys(Keys.CONTROL +"\t");
new Actions(driver).sendKeys(driver.findElement(By.tagName("html")), Keys.CONTROL).sendKeys(driver.findElement(By.tagName("html")),Keys.NUMPAD2).build().perform();
element = driver.findElement(By.xpath("//bdi[contains(text(),'Open SQL Console')]"));
ScriptUtils.waitFor(DELAY);
supa.startMeasurement("40_Open_SQL_Console");
element.click();
System.out.println("Step 40 " );
ScriptUtils.waitFor(DELAY);
``` java
element = driver.switch_to_window(element.driver.window_handles[1]);
element.sendKeys(Keys.CONTROL +"\t");
new Actions(driver).sendKeys(driver.findElement(By.tagName("html")), Keys.CONTROL).sendKeys(driver.findElement(By.tagName("html")),Keys.NUMPAD2).build().perform();
I have even tried to go directly to the page but without luck.
driver.get ("https://mo-xxxx.mo.xxxx.corp:51043/xxxx/xxxxxa/cst/catalog/index.html?target=sqlconsole&databaseid=C119");
I can tell that I am on the same page because I can find an element on the current page.
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[contains(@data-xxxx-ui, '__editor')]"}
The element can easily be found outside of java/selenium so I know it is there.