0

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

1
  • 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 '21 at 11:26
1

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

...// pseudo-code
driver.url="https://sqa.stackexchange.com";
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, privacy policy and cookie policy

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