Open GoogleCodeExporter opened 9 years ago
Issue is reproducible with latest chrome browser version 42.0.2311.90
And chrome driver v2.14 & v2.15
Sample HTML:-
<html>
<body>
<a title="PDF doc" target="_blank"
href="http://ga.berkeley.edu/wp-content/uploads/2015/02/pdf-sample.pdf">Sample
PDF document</a>
</body>
</html>
Code:-
System.setProperty("webdriver.chrome.driver",
"/usr/local/google/home/gmanikpure/Downloads/chromedriver2.15");
WebDriver driver = new ChromeDriver();
driver.get("file:///usr/local/google/home/gmanikpure/Issue1081.html");
driver.findElement(By.xpath("html/body/a")).click();
Original comment by gmanikp...@chromium.org
on 16 Apr 2015 at 7:13
Last Good build version - 42.0.2274.0
First bad build version - 42.0.2275.0
Original comment by gmanikp...@chromium.org
on 16 Apr 2015 at 11:51
Can someone please post a solution for this.
I am using chrome Version 42.0.2311.90 m and the PDF gets downloaded instead of
opening it.
Original comment by pallasra...@gmail.com
on 23 Apr 2015 at 6:45
Hello I have the same problem!
According to me chromedriver is not using chrome embedded PDF viewer, despite
it is enabled (see chrome://plugins).
Please note if you disable PDF viewer manually and try to open pdf it will be
downloaded. My workaround for that bug is to install another pdf viewer. Now my
tests are using this viewer to open pdf in new tab instead of downloading it.
The only problem I have now is to unblock this plugin. Currently pdf are loaded
but not displayed. Does anyone knows how to set "Always allow to run" flag for
plugin using java webdriver code? I have tried to use
--always-authorize-plugins or --always-authorize-plugins=true but it didn't
work.
Original comment by Wojciech...@gmail.com
on 27 Apr 2015 at 8:53
Have this same issue. We were recently forced to upgrade to the latest
chromedriver version as older versions failed to load URLs when we were running
our Selenium tests. Now our PDFs that are supposed to open in new tabs are
automatically downloading and this is not acceptable behavior.
Original comment by abullo...@gmail.com
on 27 Apr 2015 at 5:36
At some point between M41 and M42, the behavior of the --test-type switch was
changed so that PDFs are downloaded instead of displayed. As a temporary
workaround, you can disable this switch. Here's how to do that in Python:
>>> from selenium import webdriver
>>> options = webdriver.ChromeOptions()
>>> options.add_experimental_option('excludeSwitches', ['test-type'])
>>> driver = webdriver.Chrome(chrome_options=options)
One side-effect of removing this switch is that you'll get infobar warnings
about unsupported command-line flags (similar to the one in issue 799), but
these warnings should not affect the behavior of the browser.
Original comment by samu...@chromium.org
on 28 Apr 2015 at 6:46
It helped!
Thank you!
Solution in Java is as follows:
options.setExperimentalOption("excludeSwitches",Arrays.asList("test-type"));
Original comment by Wojciech...@gmail.com
on 29 Apr 2015 at 1:01
c#
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddExcludedArgument("test-type");
var browser = new ChromeDriver(chromeOptions);
Original comment by yuriy.ya...@gmail.com
on 29 Apr 2015 at 8:21
[deleted comment]
This is due to the OOP PDF viewer, which was enabled by default in
https://codereview.chromium.org/850633002
So a better workaround is to use --disable-out-of-process-pdf. This will avoid
those annoying infobar warnings:
>>> from selenium import webdriver
>>> options = webdriver.ChromeOptions()
>>> options.add_argument('--disable-out-of-process-pdf')
>>> driver = webdriver.Chrome(chrome_options=options)
Original comment by samu...@chromium.org
on 29 Apr 2015 at 8:30
[deleted comment]
Thank you! The first solution solved our problem. The 2nd solution didn't
change the behavior of our tests.
Original comment by abullo...@gmail.com
on 30 Apr 2015 at 4:09
I am using Yuri.ya's solution and it is working until a few minutes into the
test. When the pdf viewer pops up, it becomes stuck at "Loading preview..." and
chrome then becomes unresponsive.
ChromeOptions options = new ChromeOptions();
options.AddExcludedArgument("test-type");
options.AddArgument("-incognito");
options.AddArgument("-start-maximized");
driver= new ChromeDriver(driverService, options);
The issue occurs after it has loaded about 10 - 15 pdf's to print, and then
chrome becomes unresponsive. Any thoughts?
Original comment by ben.dans...@gmail.com
on 30 Apr 2015 at 7:57
[deleted comment]
This is also a problem in java. I have tried all the suggestion shown and none
worked. Does anyone have a solution?
Original comment by kcqc...@gmail.com
on 1 May 2015 at 6:20
#7 Worked for me in Java. Here is the code I used:
WebDriver driver = null;
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Arrays.asList("test-type"));
desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(desiredCapabilities);
Original comment by abullo...@gmail.com
on 1 May 2015 at 6:30
Your code worked for me.
import java.util.Arrays;
ChromeOptions options = new ChromeOptions();
DesiredCapabilities caps = DesiredCapabilities.chrome();
options.setExperimentalOption("excludeSwitches", Arrays.asList("test-type"));
caps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(options);
One additional question were you able to turn off the certificate banner ("You
are using an unsupported command-line flag: --ignore-certificate-errors.
Stability and security will suffer.") which appear at the top of the browser?
Thank you
Original comment by kcqc...@gmail.com
on 1 May 2015 at 8:35
@ben.dansie87, your issue is different than the original issue.
Can you please report a new bug ? And please provide a reproducible test page
and test code
Original comment by gmanikp...@chromium.org
on 1 May 2015 at 9:06
No, I was not able to get rid of the certificate banner. Comment #10's solution
did nothing for our project. Glad I was able to help!
Original comment by abullo...@gmail.com
on 1 May 2015 at 9:06
No problem. I got it to work by adding "ignore-certificate-errors" to the array
list.
options.setExperimentalOption("excludeSwitches",
Arrays.asList("test-type","ignore-certificate-errors"));
Once again Thank you
Original comment by kcqc...@gmail.com
on 1 May 2015 at 9:17
Nice, I will have to give that a shot. It's just an annoyance for us and not
affecting our tests but if we can get rid of it, all the better.
You're welcome and thank you!
Original comment by abullo...@gmail.com
on 1 May 2015 at 9:19
Here's the equivalent workaround for nightwatchjs, if anyone is using that
javascript testing framework:
"desiredCapabilities": {
"chromeOptions": {
"excludeSwitches": [ "test-type" ]
}
}
Joel
Original comment by j...@airspringsoftware.com
on 5 May 2015 at 4:22
@gmanikp, the issue I mentioned seems to be resolved in Chrome 43. The beta
version has fixed my issue.
Original comment by ben.dans...@gmail.com
on 7 May 2015 at 3:44
@ben.dansie87, Thanks for verifying the issue mentioned in #13!
Original comment by gmanikp...@chromium.org
on 8 May 2015 at 7:11
Hey..In Chrome 43, still we have to exclude switch test-type do make pdf render
in browser. Because once I exclude test-type switch I am facing a new problem.
My application opens PDF in new tab and while removing this switch selenium api
is not able to close the browser.
Original comment by gupta.ji...@gmail.com
on 12 May 2015 at 11:01
Hey , after applying the changes PDF is opening in new tab instead of as a POP
up, Is there any new settings need to be done to open it as a pop up.
Original comment by varunmit...@gmail.com
on 13 May 2015 at 2:41
after making "$chromeOptions.AddArgument("test-type")" change, i am getting
pop-up blocker issue for chrome. Solution please
Original comment by sapati...@gmail.com
on 15 May 2015 at 10:29
[deleted comment]
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches",
Arrays.asList("test-type","ignore-certificate-errors"));
this code worked for me
chrome version
Version 43.0.2357.65 m
Thanks alot
Original comment by sweta.de...@gmail.com
on 24 May 2015 at 2:06
C# for me it works fine:
DesiredCapabilities capabilities = DesiredCapabilities.Chrome();
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddExcludedArgument("test-type");
chromeOptions.AddExcludedArgument("ignore-certificate-errors");
capabilities = chromeOptions.ToCapabilities() as DesiredCapabilities;
Original comment by tomaszwi...@gmail.com
on 15 Jun 2015 at 12:31
#30 Would you clarify the last line? I am not sure what to do with the modified
capabilities?
Original comment by ronald.k...@gmail.com
on 26 Jun 2015 at 4:27
Hi I was struggling with this issue for a pro longed periods of time finally I
have solve this issue by the below mentioned code...
Jave Code..
DesiredCapabilities caps = DesiredCapabilities.chrome();
options.setExperimentalOption("excludeSwitches", Arrays.asList("test-type"));
options.setExperimentalOption("excludeSwitches",
Arrays.asList("testtype","ignore-certificate-errors"));
caps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(options);
Original comment by sumit16...@gmail.com
on 15 Jul 2015 at 11:21
Original issue reported on code.google.com by
vidhes...@gmail.com
on 16 Apr 2015 at 9:30