如何使用Behat和Mink PHP处理浏览器窗口或选项卡

I have test that click on link and then new browser window open and in new browser window I need to check some elements are present. How to switch to new Browser window that was opened using BEHAT/MINK?

You can use switchToWindow($windowName) method.

$this->getSession()->switchToWindow($windowName);

Method declaration is here

You can get all windows from current session and then switch to the second one for example

$windowNames = $this->getSession()->getWindowNames();
if(count($windowNames) > 1) {
    $this->getSession()->switchToWindow($windowNames[1]);
}