Search code examples
phpseleniumweb-testingheadless-browser

How to use Selenium with PHP?


I'd like to use Selenium to automate a few web tasks (not for testing). I think I have Selenium RC Server installed, but have no way of writing "test scripts" since I can't find a client driver in PHP (see: http://seleniumhq.org/download/).

Is there a way for me to use Selenium with PHP? This seems to suggest I need PHPUnit http://www.phpunit.de/manual/current/en/selenium.html. I just want to automate a few tasks, not get involved with a full suite of testing.


Solution

  • Try Following things

    1. Get Phpunit installed and working
    2. Also have JAVA sdk & jre on your pc.
    3. Now record test cases using selenium IDE.
    4. Export the testcases to php files.
    5. Using these exported functions create an library of test cases.
    6. Create suite which calls the functions/tests from library.
    7. Now to execute Start Selenium Server using java command.
    8. Using phpunit Execute the suite.

    for refrence how to write these files click here and also try on git hub