Use case is as below.

There is a modal in a website and it contains User ID, Name and email. I want to capture those details using selenium+java and send a POST api request with the above extracted details(User ID, Name and email). How can i perform this action. Highly appreciate if someone can help with a example

  • What have you tried so far, and what was the result? It seems it's a question of simply making a HTTP call using any HTTP library. Nov 2, 2021 at 11:26

1 Answer 1


At a high-level, the Selenium tests would scrape the data

...// pseudo-code
var thing1 = driver.findElement(By.Class("ws-nowrap.s-btn.s-btn__primary").text();

Then use an HTTP request to send the extracted data

...// code snippet (see link for full example)
var client = new HttpClient();
var params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("param-1", thing1));
client.SendHttp("POST", body);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.