You can’t.
Chrome is embedding a PDF reader into the page and what you are seeing is actually a PDF. You can’t access it through Selenium.
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
I can see that, but PDF is inside some kind of html page or tab. So I just want to check that this Print Preview page was opened and then close it, to continue testing app.
О©╫О©╫О©╫О©╫О©╫О©╫О©╫, 23 О©╫О©╫О©╫О©╫О©╫О©╫ 2013О©╫О©╫., 9:46:07 UTC+4 О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫ Mark Collin О©╫О©╫О©╫О©╫О©╫О©╫О©╫:You can’t.
О©╫
Chrome is embedding a PDF reader into the page О©╫and what you are seeing is actually a PDF.О©╫ You can’t access it through Selenium.
О©╫
From: webd...@googlegroups.com [mailto:webd...@googlegroups.com] On Behalf Of Yury Kryazhev
Sent: 22 April 2013 15:01
To: webd...@googlegroups.com
Subject: [webdriver] [Chrome] Handle Print Preview window
О©╫
Hi,О©╫
О©╫
I'm trying to work with Print Preview window in google chrome like this:
О©╫ О©╫ О©╫ О©╫ driver.findElement(By.xpath("//*[contains(@id, '-winBillingHistoryFull-print')]")).click(); // After clicking Print Preview window appears
О©╫ О©╫ О©╫ О©╫ driver.getWindowHandles(); // Browser crashes withО©╫UnreachableBrowserException: Error communicating with the remote browser. It may have died.
О©╫
О©╫
О©╫
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:29816 refused
Build info: version: '2.31.0', revision: '1bd294d185a80fa4206dfeab80ba773c04ac33c0', time: '2013-02-27 13:51:26'
System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2', java.version: '1.6.0_31'
Driver info: driver.version: RemoteWebDriver
Caused by: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:29816 refused
Caused by: java.net.ConnectException: Connection refused: connect
О©╫
О©╫
Any ideas why this happens and how to switch to Print Preview window?
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
О©╫
О©╫
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
О©╫
О©╫
Thx for a suggestion, but still I think it's not appropriate to throw UnreachableBrowserException when invoking driver.getWindowHandles();
О©╫О©╫О©╫О©╫О©╫О©╫О©╫, 23 О©╫О©╫О©╫О©╫О©╫О©╫ 2013О©╫О©╫., 16:18:09 UTC+4 О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫ Mark Collin О©╫О©╫О©╫О©╫О©╫О©╫О©╫:
I would suggest that this is a pointless test.
What are you going to do if chrome doesn't open the print preview page?О©╫
Can your dev team fix it (Bear in mind it will be an issue with chrome itself)?
It is if you have done something that blocks access to the browser (which you have done by opening a print preview box) because the browser is no longer reachable.
The solution is to modify your test so that it does not perform a pointless action to test something that you have no control over and will be able to do nothing about if it fails. Every test you perform should have a valid reason behind it, and each one should give you confidence that functionality your team has written works as expected.
Your team did not write the print preview functionality, it is baked into the browser, what benefit does this test give to your team? Do you also test that you can show/hide the bookmark bar on your browser?
Performing tests just "because you can" when they they have no value is a bit of a bugbear of mine. All it does it waste time and increase the amount of time it takes to run your test suites, ask yourself the following:
This is really something you do not want to do.
- How much time have you wasted trying to find a solution to this problem?
- What useful tasks could you have performed during this time (I can think of one going through your test code and refactoring it to make it better, I'm sure there are many others).
On 23/04/2013 15:55, Yury Kryazhev wrote:
Thx for a suggestion, but still I think it's not appropriate to throw UnreachableBrowserException when invoking driver.getWindowHandles();
вторник, 23 апреля 2013 г., 16:18:09 UTC+4 пользователь Mark Collin написал:
I would suggest that this is a pointless test.
What are you going to do if chrome doesn't open the print preview page?О©╫
Can your dev team fix it (Bear in mind it will be an issue with chrome itself)?
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
>> 3) Return a window handle for the print preview tab. A client could switch to it and take a screenshot.
This has been implemented in ChromeDriver 19.0.1068.0.