0 votes
in Selenium by
What does the switchTo() command do?

1 Answer

0 votes
by
switchTo() command is used to switch between windows, frames or pop-ups within the application. Every window instantiated by the WebDriver is given a unique alphanumeric value called “Window Handle”.

Get the window handle of the window you wish to switch to

   String  handle= driver.getWindowHandle();

Switch to the desired window

   driver.switchTo().window(handle);

Alternatively

  for(String handle= driver.getWindowHandles())

   { driver.switchTo().window(handle); }

Related questions

+1 vote
asked Aug 15, 2022 in NoSQL by AdilsonLima
0 votes
asked Jun 14, 2020 in Hive by Robindeniel
...