Reputation: 229
Selenium does not support this code
$statusCode = $this->getSession()->getStatusCode();
It is possible to check status any other way?
Upvotes: 3
Views: 3266
Reputation: 166879
You can use Restler, a micro framework which supports behavior Driven API testing using Behat and Guzzle.
For example (see: status_codes.feature
):
@restler
Feature: HTTP Status Codes
Scenario: I should be able to suppress status code 404
When I request "/examples/_001_helloworld?suppress_response_codes=true"
Then the response status code should be 200
Upvotes: 0
Reputation: 36241
This is not what Selenium was designed for. One of their project member in reply to request to implement this in Selenium said:
We will not be adding this feature to the WebDriver API as it falls outside of our current scope (emulating user actions).
The solution is to either use another driver that supports status codes, or try to implement one of available hacks (given in other stack overflow questions asking the very same thing).
Upvotes: 2