Я использую следующие в моих тестах. Вам нужно явно изменить фокус на всплывающее окно в вашем скрипте.
.window_handles(function(result) { // Since two windows are open we need to get the window ids
var temp = result.value[1]; //
this.switchWindow(temp); // and switch focus to the new window so that the next command is run against it
}) //
для переключения фокуса обратно в исходное окно, вы можете использовать следующие
.window_handles(function(result) { // Since two windows are open we need to get the window ids
var temp = result.value[0]; //
this.switchWindow(temp); // and switch focus to the new window so that the next command is run against it
}) //