Skip to content

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

@yamelyamel16

Description

@yamelyamel16

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions