Skip to content

Set desired capabilities for firefox #175

Open

Description

@TugcaEker

I couldn't add capability to firefox driver. I added proxy option for connection but I couldn't set 'permissions.default.image' as '2'. Briefly, I want to disable image loading while test continue. What am I doing wrong?

$driver = new \Behat\Mink\Driver\Selenium2Driver(
    'firefox',
    array(
        "proxy" => array(
            "proxyType" => "manual",
            "httpProxy" => Core::selectProxy(),
        ),
        "permissions.default.image" => 2

    )
);

(also I'm tried to send it as array)

Activity

  1. aik099 commented on Jul 25, 2014

    @aik099
    Member

    Could you post links to some documentation about WebDriver + Firefox + Desired Capabilities.

    Also what proxy stuff is doing there? First time I see that one.

  2. TugcaEker commented on Jul 25, 2014

    @TugcaEker
    Author

    Core::selectProxy() is a function which can choose one of my proxies from the list.
    You can look through, https://code.google.com/p/selenium/wiki/DesiredCapabilities

  3. TugcaEker commented on Jul 25, 2014

    @TugcaEker
    Author

    Do you have any idea to set image loadings enable/disable?

  4. aik099 commented on Jul 27, 2014

    @aik099
    Member

    Googling a bit about the subject reveals topics, where people do this by changing Firefox profile. I guess there is no such desired capability that you're talking about after all.

  5. stof commented on Aug 13, 2014

    @stof
    Member

    Well, Selenium2 capabilities don't allow to define each Firefox setting separately. There is a single capability for setting the profile, which is something in base64 (but the Selenium documentation only has TODO: Document format about what should go inside this base64-encoded string).

    Once you figure what goes inside, this can be configured this way:

    $driver = new \Behat\Mink\Driver\Selenium2Driver(
        'firefox',
        array(
            'firefox' => array(
                'profile' => base64_encode($profile),
            ),
        )
    );
  6. stof commented on Aug 13, 2014

    @stof
    Member

    hmm, actually no. If you have the string content, you should set the firefox_profile key in the capabilities directly. the profile key inside firefox expects a path to a Firefox profile, and it will handle base64-encoding its content.

  7. kl3ryk commented on May 11, 2015

    @kl3ryk

    @TugcaEker profile should be zipped with prefs.js in root of the archive and then you can set it as follows::

            $this->driver->setDesiredCapabilities([
                'firefox' => [
                    'profile' => 'foo\testProfile.zip',
                ]
            ]);

    or you can set it like @stof mentoioned using firefox_profile key:

            $this->driver->setDesiredCapabilities([
                'firefox_profile' => 'base64 of zipped profile'
            ]);

    The first metod is just a sugar for the second one. You can find it here:
    https://github.com/minkphp/MinkSelenium2Driver/blob/master/src/Selenium2Driver.php#L111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions