Testing AJAX pages with PHPUnit

When you test pages that work with AJAX using PHPUnit, the situation appears that the function assertTextPresent returns false because the page is not reloaded and the loading might be slow. The solution is to use:

waitForTextPresent ( pattern )


The requested URL /selenium-server/core/RemoteRunner.html was not found on this server.

So you’ve just installed Selenium server and you want to run a phpUnit test.
You’ve started the server:

java -jar selenium-server-standalone-2.6.0.jar

And now you run your phpUnit:

phpunit tests/MyTest.php

And surprisingly you get this error in your browser:

The requested URL /selenium-server/core/RemoteRunner.html was not found on this server.

What to do?
Here is a solution that helped me:
1. Open your browser (the one that is started by Selenium);
2. Go to proxy settings (For firefox 6 on linux: Edit->Preferences->Advanced->Network->Connection: Settings->Manual Proxy configuration and set there host: localhost and port: 4444) and change the host to localhost and port to 4444;
3. Rerun your tests

Note: In case your firefox doesn’t start, modify your phpunit.xml file and set

 browser name=”Firefox” browser=”*custom /bin/firefox”

Or depending where your firefox is.
Good luck!