F
F
ff0xff2017-04-09 18:06:58
PHP
ff0xff, 2017-04-09 18:06:58

How to start firefox with specified profile using php-webdriver and selenium?

Kind time of the day, help me figure out the issue, I myself can not. You need to run a unit test using the stack:

  • phpunit (PHP 7.0.8)
  • selenium-server-standalone-2.53.1
  • php webdriver
  • OS: Ubuntu Server
  • Firefox 47.0.0.1

The essence of the problem: when selen is run, it creates a new profile for the user every time when using Firefox. The task is to start firefox with a pre-prepared profile that is in the directory, I want to note the fact that using -firefoxProfileTemplate ( the key to start selen ) is not suitable. I need to load different profiles with each new test... (restarting selen every time with the right key is stupid and not rational)
I use this simple code for the test
<?php
$host = 'http://localhost:4444/wd/hub';
$capabilities = DesiredCapabilities::firefox();
$profile = new \Facebook\WebDriver\Firefox\FirefoxProfile();
$profile->setPreference('network.proxy.socks_remote_dns', false);
$capabilities->setCapability(\Facebook\WebDriver\Firefox\FirefoxDriver::PROFILE, $profile);
$capabilities->setCapability(
    'proxy',
    [
        'proxyType' => 'manual',
        'httpProxy' => '127.0.0.1', // proxy for http
        'sslProxy' => '127.0.0.1', // proxy for https
    ]
);
$driver = RemoteWebDriver::create($host, $capabilities, 5000,120000);
?>

I was on the resources: here , here but I still don’t understand how to start firefox with a different profile, I ask dear members of the forum to help me with this task.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question