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

霸气de小男生 提交于 2019-12-10 15:06:17

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/18391511/how-do-i-ask-selenium-ide-to-check-a-http-status-code-e-g-2xx-404-500

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!