Chirag verma
Chirag verma

Reputation: 343

Verify POST request was successful or not using selenium python

I have a question regarding verifying if the POST request was successful or not. Is there a way to achieve this with selenium? Or any other tool that can be integrated with selenium?

Maybe click on the button and check if it returns 200 status or not?

Upvotes: 1

Views: 1220

Answers (1)

d0x
d0x

Reputation: 11571

In java you can use the Browsermob-Proxy http://bmp.lightbody.net/ which integrates nicely with selenium. What it does, it intercepts all the communication and you can get the statuscode with it. You can try to find a python proxy so you can do the same.

The selenium API won't give you statuscodes. That was a "political" decision some years ago.

On StackOverflow some people suggest sending another request with another tool to check the statuscode. Depending on your usecase that could be enough for you.

Upvotes: 1

Related Questions