Moving around windows, frames and iframes

// To get the current window handle:
$handle = $driver->getWindlowHandle();

// To get all available window handles:
$handles = $driver->getWindowHandles();

// To switch to another window:
$driver->switchTo()->window($handle);

// To close the current window:
$driver->close();

// To switch to another frame:
$driver->switchTo()->frame($name_or_id_of_the_frame);

// To switch back to the top frame:
$driver->switchTo()->defaultContent();