Strange that you should post this now, because that is exactly what I
was coming to ask about. I am using 2.5.0 with
WebDriverBackedSelenium to do this. Here is my code (I have been
experimenting with it a bit):
selenium.click(DOTN_Data.VIEW_TRANS_MENU_PRINTER_FRIENDLY_DETAIL);
selenium.waitForPopUp("_blank", "30000");
selenium.selectWindow("pdftrans.cfm (application/pdf Object)");
//selenium.selectPopUp("_blank");
selenium.close();
Reporter.log("Current window title: '" + selenium.getTitle() + "'",
true);
I originally recorded this using the IDE and the selectWindow used to
be the commented out selenium.selectPopUp("_blank") and I swear it
worked when played back there.
I added the Reporter.log() line to see if it had switched back to the
main window, because doing a selenium.selectWindow(null) was throwing
an exception. If I comment out that line and let it proceed to the
next routine (my @AfterSuite method that logs off from the site) it
fails at the first line in there, which is also doing a
selenium.getTitle() as it turns out.
This window is a PDF file being displayed by the Acroread plug-in on
Windows in Firefox, in case that matters.
Here is my stack trace from doing the getTitle() after I have closed
the pop up window:
com.thoughtworks.selenium.SeleniumException: Component returned
failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED)
[nsIDOMJSWindow.setTimeout]
Build info: version: '2.5.0', revision: '13516', time: '2011-08-23
18:29:57'
System info:
os.name: 'Windows Vista', os.arch: 'x86', os.version:
'6.0', java.version: '1.6.0_27'
Driver info: driver.version: unknown
Build info: version: '2.5.0', revision: '13516', time: '2011-08-23
18:30:44'
System info:
os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
java.version: '1.6.0_26'
Driver info: driver.version: RemoteWebDriver
at
org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:
41)
at
org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:
38)
at
org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:
170)
at
org.openqa.selenium.WebDriverCommandProcessor.getString(WebDriverCommandProcessor.java:
141)
at
com.thoughtworks.selenium.DefaultSelenium.getTitle(DefaultSelenium.java:
431)
at dotn_helper.LoginAndLogoff.testLogout(LoginAndLogoff.java:167)
at current.Current.testFinish(Current.java:160)
So the big question for me is how do I get switched back to the main
window after closing the pop up window?
Or am I supposed to switch back first and close the pop up window some
other way.
A side issue is that when I try to do a screen capture of the pop up
window all I get is an empty frame, but I imagine that is because it
can't capture an image from acroread, correct?
Mike
On Nov 8, 9:10 am, "
subhabrata.banerje...@gmail.com"