How to check url request response as 200 successfully

Best practices, code snippets for common functionality, examples, and guidelines.
csolanki
Posts: 120
Joined: Thu Mar 22, 2018 8:51 am

How to check url request response as 200 successfully

Post by csolanki » Mon Nov 26, 2018 11:32 am

Hey,

I have read posts regarding api testing and request module ,which we can use in checking response successfully. But I wanted to know, irrespective of the URL, can I just check response is coming as 200 or not ? any UI is under process for the same ?
Regards,
Charu Solanki
Ranorex User

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to check url request response as 200 successfully

Post by odklizec » Tue Nov 27, 2018 4:12 pm

Hi,

If you mean you want to get the response code from Ranorex action like OpenBrowser, then no, there is no such feature. If you want to get the response code from web request, then you need to write some code for this. Check for example this post:
https://stackoverflow.com/questions/133 ... est-and-ht
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Vega
Posts: 222
Joined: Tue Jan 17, 2023 7:50 pm

Re: How to check url request response as 200 successfully

Post by Vega » Wed Nov 28, 2018 10:44 pm

Additionally if you want to get the response from an in browser request, you can use something like Chrome dev tools:
form1.png
Just remember if you want to automate and Chrome form objects, you need to launch Chrome with the below flag (just add it to the arguments part of the open browser action):

Code: Select all

--force-renderer-accessibility
But as odklizec mentioned depending on your requirements you may be better off using a coded approach. Just know that coded network requests do not line up with what is in the browser as coded requests make requests outside of the browser...unless you have some type of middleware to pipe the requests from the browser to your API/code/whatever.

Hope this helps
You do not have the required permissions to view the files attached to this post.

csolanki
Posts: 120
Joined: Thu Mar 22, 2018 8:51 am

Re: How to check url request response as 200 successfully

Post by csolanki » Fri Dec 14, 2018 3:11 pm

Thanks much Gyz. It helped.
Regards,
Charu Solanki
Ranorex User