0

I am trying to switch to a Gmail login popup that appears on clicking a button on my chrome. When I do a driver getWindowHandles(), it shows only one window - the parent. Also I noticed in the taskbar that the popup that opens has a google/gmail icon instead of chrome browser icon which is why I am assuming that the Webdriver does not count it as a second open "chrome" window, but instead a different one altogether.

So far I have tried everything on the driver methods

driver.switchTo().window(1 or 0)

Any suggestions would be helpful!!

2 Answers2

0
driver.switchTo().alert().anyMethod    

can be used.

0

First of all, why are you using driver. with Selenide? Selenide has a static WebDriver call - getWebDriver() (if really needed) with the next import import static com.codeborne.selenide.WebDriverRunner.getWebDriver;

From your quesiton, it is not clear what you want - either its pop up that appears after clicking or you want to switch to another chrome tab window?

If its a pop up alert, then the next code should help (to accept it for example):

getWebDriver().switchTo().alert().accept();

If you want to open a tab or focus on it:

switchTo().window(1);
imbasheep
  • 92
  • 3
  • 9