Please share if anyone used Selenium to get server side errors.
Asked
Active
Viewed 415 times
5
-
If you know error behavior in advance then you can specify in webdriver code.So in future if same error occur then your selenium web driver will indicate. – Helping Hands Feb 25 '15 at 05:49
-
Here's the link which gives me php error: http://selenium.couponapitest.com/page-2.php. Could you please explain how can i handle this with webdriver code?. Thank you – learner Feb 25 '15 at 05:55
-
you define one common element which is in every page and then when load page at that time check that if you are getting that element or not.if not then there is some error on page. – Helping Hands Feb 25 '15 at 05:59
-
But that could not help to find the specific error. E.g.- error could be due to 404 status code, php error etc. How can i be sure that it is a php error? – learner Feb 25 '15 at 06:05
-
I do not think you can find specific using selenium.Still wait for other reply.May be some expert can help you. – Helping Hands Feb 25 '15 at 06:07
-
For HTTP-specific features, one can use HttpURLConnection class in java (http://download.java.net/jdk7/archive/b123/docs/api/java/net/HttpURLConnection.html) to validate status code, response message etc. To catch javascript errors with selenium java, use ((JavascriptExecutor) driver).executeScript("return window.javascript_errors "); Looking for the solution to catch php errors with selenium. – learner Feb 25 '15 at 06:48
-
Take a look at http://stackoverflow.com/q/3071760/2504101 – olyv Feb 26 '15 at 07:06
1 Answers
0
PHPUnit allows to add checks that are run before or after every test function. Just add a assertPreConditions() or assertPostConditions() to your test to see if there are traces of PHP failure.
See http://phpunit.de/manual/3.7/en/fixtures.html for some more details.

Matthieu McClintock
- 135
- 1
- 7
-
Selenium is integration tests. PHPUnit is unit tests. I don't think you can use PHPUnit stuff for Selenium. – RedDragonWebDesign Apr 29 '22 at 07:04