Не могу попасть в всплывающее окно

Добрый день!
При нажатии на кнопку сайта, всплавет попап, в который необходимо ввести текст. Вот его код

<div id="zoom" style="z-index: 666; position: absolute; top: 939px; left: 500px; width: 680px; height: 370px;">
<table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;">
<tbody>
<tr>
<td class="tl" style="background:url(http://ua.20.img/images/tl.png) 0 0 no-repeat; width:20px; height:20px; overflow:hidden;"></td>
<td class="tm" style="background:url(http://ua.20.img/images/tm.png) 0 0 repeat-x; height:20px; overflow:hidden;"></td>
<td class="tr" style="background:url(http://ua.20.img/images/tr.png) 100% 0 no-repeat; width:20px; height:20px; overflow:hidden;"></td>
</tr>
<tr>
<td class="ml" style="background:url(http://ua.20.img/images/ml.png) 0 0 repeat-y; width:20px; overflow:hidden;"></td>
<td class="mm" style="background:#fff; vertical-align:top; padding:10px;">
<div id="zoom_content" style="width: 100%; height: 100%; overflow: hidden;">
<div class="contactWithAuthorAdBlockInsWait waitBlock"></div>
<div class="infoPOP02 contactWithAuthorAdBlockIns">
<div class="topLine48">
<div class="inPoEv">
<form onsubmit="showBlurWait('#zoom .contactWithAuthorAdBlockIns', '#zoom .contactWithAuthorAdBlockInsWait'); jQuery.ajax({data:jQuery.param(jQuery(this).serializeArray()) + '&authenticity_token=' + encodeURIComponent('a13216acbb002b9dd022ebd54f8211b89c47f551dbf9e8aa6b88ce54b5d9f091'), dataType:'script', error:function(request){closeFeedback();}, success:function(request){if (validateFeedbackResponseJson(request, 'cwa', '#zoom .contactWithAuthorAdBlockInsWait', 'cwa_simple_captcha_wrapper', 'cwa_captcha')){closeFeedback();showSuccessFeedbackJson(request);}}, type:'post', url:'http://real-estate.20.local/ru/ajax/contact_with_author'}); return false;" method="post" action="http://real-estate.20.local/ru/ajax/contact_with_author">
<div style="margin:0;padding:0;display:inline">
<input id="contact_with_author_obj_id" type="hidden" value="9309320" name="contact_with_author[obj_id]">
<input id="contact_with_author_obj_type" type="hidden" value="advertisement" name="contact_with_author[obj_type]">
<div class="inPoEvMarg2">
<div class="inPoEvMarg3">
<div class="greyB03">
<table class="formTablePOP02" width="577" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<tr>
<td colspan="2">
<div class="onLineHint">
<textarea class="cont_with_auth_body popfi05" maxlength="5000" name="contact_with_author[body]" cols="3" rows="3"></textarea>
<div class="fbAlertMess hidenBlock cwaBodyErMess" style="display: none;">Введите сообщение</div>
</td>
</tr>
<tr>
<tr>
</tbody>
</table>
</div>
</div>
</form>
</div>
<div class="topLine48a">
</div>
</div>
</td>
<td class="mr" style="background:url(http://ua.20.img/images/mr.png) 100% 0 repeat-y; width:20px; overflow:hidden;"></td>
</tr>
<tr>
</tbody>
</table>
<a id="zoom_close" style="position: absolute; top: 0px; left: 0px; display: block;" title="Close" href="#" curtop="1168" curleft="478" scaleimg="false">
</div>

Попытки определить название данного окна не увенчались успехом. Я пробывал:

// get all the window handles before the popup window appears
	     Set<String> beforePopup = driver.getWindowHandles();

	     // click the link which creates the popup window
	     driver.findElement(By.className("contact_with_author")).click();
Thread.sleep(5000);
	     // get all the window handles after the popup window appears
	     Set<String> afterPopup = driver.getWindowHandles();

	     // remove all the handles from before the popup window appears
	     afterPopup.removeAll(beforePopup);
	     System.out.println(afterPopup);
	     // there should be only one window handle left
	     if(afterPopup.size() == 1) {
	       System.out.println(afterPopup);
	 } else {System.out.println("Не судьба");

Т.к. в данном случае afterPopup = null
Ну и собственно вопрос, как мне туда попасть?
P.S. Немного пишу на Java, selenium 39, FF 26.0

Попробуйте дождаться появления элемента, который есть в popup. Вот например таким способом:
WebDriverWait webDriverWait = new WebDriverWait(webDriver, 10);
webElement = webDriverWait.until(ExpectedConditions.visibilityOfElementLocated(By.className(“right-btn”)));

ставил задержки, так что боюсь проблема не в ожидании, а именно в переключении в данное окно

Ставили, задержки на появление элемента в данном попапе? У меня тоже такая проблема была и я ее решила поставив ожидание на элемент, который появляется на попапе.

да. между кликом на кнопку вызывающую попап и переключением на него (и соответственно поиском данного элемента). кроме того, я использую driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); , соответственно дело не в паузе

А пробовали продебажить? Если я правильно понимаю судя по коду у Вас на попапе есть 2 поля у которых type=“hidden”. Поэтому вебдрайвер просто не находит элемент на страницы.И нужно заставить его подождать пока какое то из этих полей появится.

Скриншот попапа покажи. А конкретно, два окна - родительское и всплывающее. Ты уверен, что это окно браузера, а не div какой-нибудь?

Ну так это не отдельное окно в терминах WebDriver. Поэтому и getWindowHandles() ничего нового тебе не выдает.

Это всплывающее окно реализовано внутри того же документа, что и родительское, поэтому к элементам внутри него можно обращаться, как к любым другим элементам DOM твоего документа. Например, findElement(By.id("cont_with_auth_email"))

в том-то и проблема, что не находит просто так

хД. фрейм ищите.

драйвер нашел необходимые элементы по absolute xpath. укроченные варианты, id и classname не работают. а с чем такое поведение может быть связано?

Ну, например

  1. может быть несколько элементов с одинаковым id (не говоря уже о classname)
  2. в момент поиска элемент может отсутствовать в документе
  3. в момент обращения к элементу, он может быть невидимым

понятно. всем спасибо!