WebDriver: correctly handle main frame handles