Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get HTTP status code from the response #470

Closed
cardonator opened this issue Sep 2, 2017 · 2 comments
Closed

Get HTTP status code from the response #470

cardonator opened this issue Sep 2, 2017 · 2 comments

Comments

@cardonator
Copy link

cardonator commented Sep 2, 2017

What are you trying to achieve? (Expected behavior)

I would like to be able to check HTTP response codes as part of my tests.

What do you get instead? (Actual behavior)

I can't see a way this data is exposed.

How could the issue be reproduced? (Steps to reproduce)

Just create a web driver and get/navigate to a page.

Details

  • Php-webdriver version: 1.4
  • PHP version: 5.6
  • Selenium server version: 3.3.1
  • Operating system: Docker/Ubuntu
@OndraM
Copy link
Collaborator

OndraM commented Sep 2, 2017

Hi, HTTP status codes are intentionally not available directly through Selenium, because Selenium mission statement is to "emulate user actions" (and user does not see and interact with HTTP codes). See SeleniumHQ/selenium-google-code-issue-archive#141 for a discussion regarding this issue.
HTTP status codes could be tested using different layer of tests than Selenium tests.

However you have some options, see https://saucelabs.com/blog/options-for-validating-http-codes-in-selenium.

@OndraM OndraM closed this as completed Sep 2, 2017
@OndraM OndraM changed the title Expose HTTP Response information to the driver Get HTTP status codes from the response Sep 2, 2017
@OndraM OndraM changed the title Get HTTP status codes from the response Get HTTP status code from the response Sep 2, 2017
@cardonator
Copy link
Author

Thanks, I had read both of those links before. They are kind of annoying responses and here's why:

I have a page that requires the user to pass a valid client cert. My test should expect an HTTP response requesting a client cert. That's user actionable even though the code itself is not technically what the user sees. At any rate, this was a convenience thing. Of course there are 50 ways to solve it. It would just be nice if it was in the same package I'm already using for UI acceptance. Thanks for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants