Troubleshooting
As mentioned already, wpselenium should work seemlessly. Below however, are some errors you might get, and how to resolve them. If your issue cannot be resolved by the steps below (or you are getting a different error not covered below), please email wpselenium@centridsol.tech or leave an issue on our github page.
Unable to create new service: Driver info: driver.version: unknown
This error usually means your driver was not installed properly or its not on your system path.
To check if it is installed properly navigate to
vendor/devchid/wpselenium/bin
. If your driver is not there then it didnt install properly. Rerun wpselenium to see if that gets resolved. If it doesn't get resolved and you need a quick fix, you can download (and unpack) the driver directly into the bin folder.If the driver is there, then there is a problem with wpselenium setting up the enviroment variables correctly. Please could you report this if this is the case. If you need a quick fix you can directly add the path
[path_to_project]vendor/devchid/wpselenium/bin
to your system path.Failed to connect to localhost port 4444: Connection refused
This means the selenium server is not starting up correctly.
Note:- if you set the port explicitly in your wpselenium.xml, the error will mention that port instead of the 4444. Also use the port you set in the command below.
In some cases this could be a race condition in which tests start running while the selenium server is still starting up/shutting down. In this case you will need to rerun wpselenium again. If the problem persists you might need to start the selenium server directly to troubleshoot. Do this by running
java -jar vendor/devchid/wpselenium/bin/seleniumServer.jar -port 4444
WordPress specific
Error Establishing a Database Connection (or similar)
If you can access your WordPress site directly without a problem (i.e don't get the same error) it means you are running you wpselenium tests using a different version of php. This is particularly common when using xampp/lammp as it bundles it's own version of php. To fix this ensure that your system PATH variable points to the one WordPress is using, before the system one.