Tasks
Sending HTTP requests and parsing JSON in TestComplete. Here are the steps how it can be resolved:
- Send a GET request to https://dog.ceo/api/breeds/image/random. Check the status of the request - if it is successful, the response will return a JSON that contains a link to a random picture of a dog.
- Parse the returned JSON to extract the link to the image. JavaScript and Python provide support for JSON out of the box; for other languages, you might want to parse JSON as a string or use regular expressions.
- Send a GET request to the URL obtained from the previous response - this will return an image.
4. Save the response as an image to a JPG file by calling the SaveToFile method like this: response.SaveToFile("C:\\image.jpg")
Solution
Screen of img:
Image may be NSFW.
Clik here to view.