Selenium: is the first window handle always the main window?

Is the first window a guaranteed main window? Or is the order random and inconsistent?

for (String handle : driver.getWindowHandles()) {
    driver.switchTo().window(handle);
}

I cannot find any information about the order of the window descriptors, just a way to repeat them all. I assume that the main window will be the first in the list of window handles.

+4
source share
2 answers

According to the current WebDriver API Specification :

6.3 Windows Iteration

getWindowHandles

, . , , . javascript "window.top.closed" ( ) false .

, .

, - .

+3

alece , .

, , , Selenium ( , ), . , , , , , .

"" "" , , . , , - .

+2

Source: https://habr.com/ru/post/1568853/


All Articles