Selenium and Postman integration or other approach?

ann from

I am looking for general idea, approach and subsequently a right tool. I plan to start testing administration panel. Stable parts of it can be tested by mean of selenium-python scripts. But the challange starts when before testing some funcionalities in panel I need to sent a batch of data via Postman to API endpoint.

As you know Postman is a native app, so it doesn't offer a url which selenium driver could access (browser extension is deprecated.

So the question is. Would it be possible to integrate and automate the process in one selenium script?

Is it possible to do it with Postman or there is another tool that can send a request to endpoint and can be integrated with selenium script?

One more thing. The best approach would be: Sending request and few second after that action start selenium test on data which have been delivered via request to panel. I need to fully automate the process and set those actions with no sighnificant time delay.

Curious about possible solutions.

api selenium postman


answered 6 days ago Debaditya Bhattacharya #1

For API Automation purpose, Use Rest Assured. Its easy to learn, implement. You'll be able to fully automate apis(both JSON & XML). All the validation will be done in seconds. If you integrate RestAssured & Selenium, you'll be able to validate data with API & front end. Please let me know if you need to know more on this.

Sample GET Code :-

RestAssured.baseURI="base url Eg :-";given().header("Accept","application/json").header("Authorization","Value").when().get("rest of the part of the url").then().assertThat().statusCode(200).and().contentType(ContentType.JSON).and().body("name[0]",equalTo("Location"));

Sample POST Code :-


        Response res=given().header("Authorization","Value").header("cache-control","no-cache").header("content-type","application/json").body("{"+"\"format\":[\"live-blog\",\"video-story\",\"Photo Gallery\",\"photo-gallery\",\"blank\",\"breaking-news\",\"photo-story\"],"+"\"language\": \"english\""+"}").when().post("Rest of the url`enter code here`").


        String res_string= res.asString();

        JsonPath jpath = new JsonPath(res_string);

        String articleid = jpath.get("[0].articleId");

You can find all the jar files online. Apologies for the format.

answered 6 days ago Breaks Software #2

Since you are using Python already, you could easily use the 'requests' python package to send your API requests and parse the responses as required. This would allow you to easily integrate this into your overall script, sending the api requests, ensuring the necessary response, then starting the selenium steps.

answered 6 days ago YogevAbr #3

Selenium purpose is not testing your app's APIs, but web.
I would suggest as someone commented here, use Java with Rest-Assured, it's very reliable, easy to learn, and fast.
You can use Java's API call if you need anything specific for your web testing, as a requirement or something else.