Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium::Firefox::Profile->set_boolean_preference not working #485

Open
yamelyamel16 opened this issue Apr 12, 2023 · 1 comment
Open

Comments

@yamelyamel16
Copy link

It seems that the method set_boolean_preference doesn't get the job done since the pdf viewer is still active.

If i change 'pdfjs.disabled' through 'about:config' in the Firefox controlled by Selenium, it works fine.

This is the code i'm working with:

#!/bin/perl

use warnings;
use strict;
use Selenium::Firefox;
use Selenium::Firefox::Profile;

my $profile       = Selenium::Firefox::Profile->new();

$profile->set_preference(
    "browser.download.folderList"            => 2,
    "browser.download.dir"                   => "/home/",
    "browser.helperApps.neverAsk.saveToDisk" => "application/pdf",
);
$profile->set_boolean_preference(
     "pdfjs.disabled"  => 1 # <---------- doesnt seem to work
);

my $driver = Selenium::Firefox->new( firefox_profile => $profile ) or die $!;

print $profile->get_preference("pdfjs.disabled")."\n";

eval
{
    $driver->get("https://www.orimi.com/pdf-test.pdf");
};

sleep 5;

if ($@)
{
    print "$@\n";
}

$driver->shutdown_binary;

Maybe i'm missing something but as far as i can tell, it should work.

Thanks in advance !

@teodesian
Copy link
Owner

2 questions:

Does it work when you provide JSON::True instead of 1?
Does the same work with set_preference()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants