How to get status code by using selenium.py (python code)

0
0

I am writing a selenium script by python, but I think I don’t see any information about:

How to get http status code from selenium Python code.

Or I missing something. If anyone found that, please feel free to post.

  • You must to post comments
0
0

It’s Not Possible.

Unfortunately, Selenium does not provide this information by design. There is a very lengthy discussion about this, but the short of it is that:

  1. Selenium is a browser emulation tool, not necessarily a testing tool.
  2. Selenium performs many GETs and POSTs during the process of rendering a page and adding an interface for that would complicate the API in ways the authors resist.

We’re left with hacks like:

  1. Look for error information in the returned HTML.
  2. Use another tool instead like Requests (but see the shortcomings of that approach in @Zeinab’s answer.
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website