1

I've been looking for a way to run phpunit-selenium with firefox+firebug addon. I've found examples for Selenium with Java and C# but not with PHPUnit. Could someone please point me in the right direct with an example?

Right now I start my tests / browser from the command line like so: java -jar "selenium.jar" -Dwebdriver.firefox.bin = "my custom firefox app folder on osx"

I noticed you can also use the -Dwebdriver.firefox.profile to use a custom profile. But I didn't find an example for something like a -Dwebdriver.firefox.addon = firebug.xpi

kind regards,

Westworld

westworld.be
  • 244
  • 3
  • 7
  • Just out of curiosity: what is your purpose of having Firebug available in your automated browser tests? What do you use it for? – pixelistik May 30 '13 at 08:15
  • I was hoping to capture any javascript errors from the console + test if I can export network info – westworld.be May 30 '13 at 08:18

1 Answers1

0

The Selenium Webdriver protocol allows uploading a Firefox profile that should be used for the test session. You need to send a zipped and base64-encoded profile data folder to Selenium. Here's some information on how to achieve this using the Facebook php-webdriver. How you achieve this depends on the way you initiate your browser sessions with Selenium.

According to the documentation of the Facebook php-webdriver, you would pass the base64 encoded zip file to Selenium as an additional key named firefox_profile in the desired capabilities when you set up the browser session.

PHPUnit-Selenium also has a way to set up custom desired capabilities. I have never worked with it, but it could roughly look like this:

public function setUp()
{
    parent::setUp();
    $this->setDesiredCapabilities(array(
        'firefox_profile' => $profileZipBase64
    ));
} 

In order to prepare the profile, you would manually start Firefox with a clean profile, then install the Firebug addon. Here's an answer that provides some more details on how to prepare the profile data (simply represented by $profileZipBase64 here).

Community
  • 1
  • 1
pixelistik
  • 7,541
  • 3
  • 32
  • 42
  • That link is for the facebook Selenium implementation. I'm working with https://github.com/sebastianbergmann/phpunit-selenium – westworld.be May 30 '13 at 08:20
  • They're both based on the JSON Wire Protocol for Selenium. I've added some speculation on how to achieve the same result with the PHPUnit driver. You need to work out the rest for yourself, sorry. – pixelistik May 30 '13 at 09:13