Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I ask Selenium IDE to check a HTTP Status Code (e.g. 2XX, 404, 500)

Tags:

selenium-ide

How do I ask Selenium IDE to test HTTP Status codes after loading a page? I know this is possible (but awkward) in regular Selenium, how about in Selenium-IDE? Is there a plugin or other way to get something like:

open http://www.example.com/changepassword/obama
assertHTTPStatus 5XX

Thus asserting either success (or this this case failure) or a particular open? Without checking the status code, I have to check page text, which is fragile as someone might redesign the look or feel of the error page.

There are a number of existing Stack questions that touch on this topic without addressing it head on:

  • Selenium IDE - always fail on any 500 error
  • Checking HTTP Status Code in Selenium
like image 623
Bryce Avatar asked Aug 22 '13 21:08

Bryce


1 Answers

You can't. The Selenium developers made a conscious decision not to include this data at the Webdriver level. See webdriver Bug #141 and the blog post Rantings of a Selenium Contributor which lays it out clearly:

Just as proponents of wanting to see HTTP status codes in the WebDriver API are convinced that the arguments against including it don't hold water, the members of the project team are equally convinced that adding it is a bad idea.

If you really want to do it, you'll have to use tricks such as in this answer, or pick a different tool.

like image 58
Bryce Avatar answered Oct 10 '22 23:10

Bryce