golmschenk
golmschenk

Reputation: 12424

Selenium PHPUnit - Check which browsers are installed on the local machine?

I'm currently running my Selenium through PHPUnit. The project I'm working on has multiple developers and machines which the project is being developed on. What I would like to do is have Selenium/PHPUnit set the browsers being used for the Selenium tests based on what browsers are installed on the local machine the test is being run on. In other words, when on Windows, IE will be tested. While on Ubuntu, IE will not be tested (unless the user has it installed for some reason). Is there some clean way of doing this using what's already setup in Selenium or PHPUnit? Or would I have to build some sketchy workaround? Thank you much!

Upvotes: 2

Views: 182

Answers (1)

Greg
Greg

Reputation: 5588

selenium doesn't do this automatically. If you tell it to run firefox and firefox isnt installed you'll just get a stacktrace. Try a workaround instead, or just configure your boxes manually

EDIT Try checking out http://php.net/manual/en/function.php-uname.php

//Pseudocode
OS = php_uname (["s"])
    if (OS == 'Ubuntu'){
       run Chrome
       run Firefox
    }elseif(OS == 'Mac'){
       run Safari
    }

Upvotes: 1

Related Questions