Hi all,
I'm running integration tests with Selenium 2.41 over a web application
whose interface is developed with Apache Wicket 6.14.0, and I created an
instance of Selenium Firefox web driver this way:
protected WebDriver seleniumDriver = new FirefoxDriver();
||
I've a page creating a Wicket ModalWindow; by clicking a button it shows
modal window page to edit or create something.
This Modal window is very simple: has two input text fields and a Save
button.
With Selenium I'm trying to type something into these text fields but
I'm only able to access modal window so:
seleniumDriver.findElement(By.xpath("//a[contains(text(),'Create new
configuration')]")).click();
||
then selenium web driver control stucks on main page, so (following some
examples and Selenium documentation) I wrote this code to "switch"
control on modal window:
//Store the current window handle
String parentWindow = seleniumDriver.getWindowHandle();
// switch to configuration modal window
for (String winHandle : seleniumDriver.getWindowHandles()) {
seleniumDriver.switchTo().window(winHandle);
}
WebDriverWait webDriverWaitHalfMinModal = new
WebDriverWait(seleniumDriver, 10L);
webDriverWaitHalfMinModal.until(ExpectedConditions.presenceOfElementLocated(By.
xpath("//input[@name='key:textField']")));
// do something in modal window
//Close the new window, if that window no more required
seleniumDriver.close();
//Switch back to original browser (parent window)
seleniumDriver.switchTo().window(parentWindow);
||||
But there is no way to make it work, in fact list of window handles has
only 1 element, the main page, and not two elements (main and modal
page) and there is no way to find text field in the modal window opened
with button press. I point out that the rest of my code is working, I'm
not able to work only with modal windows.
My question are:
1) How can I manage properly APACHE WICKET 6 modal windows with Selenium
[2.41]?
2) Is there a particularity of Apache Wicket Modal Window that causes
this Selenium blindness against it?
I know that this is more a Selenium issue than an Apache Wicket one, but
I think that is useful let you know about this (apparently) annoying
problem.
Best Regards,
Andrea