Integrate HttpClient into Webdriver

Folks,

if you are testing anything on POST/GET like request you may integrate HttpClient into Webdriver, Here is a sample to create logins using HttpClient


PostMethod post = new PostMethod("http://jakarata.apache.org/");

NameValuePair[] data = {

  new NameValuePair("user", "joy"),

  new NameValuePair("password", "password")

};

post.setRequestBody(data);

// execute method and handle any error responses.

...

InputStream in = post.getResponseBodyAsStream();

// handle response.

Comments

  1. This example post doesn't show where the integration comes in. It would be interesting to show integration where the cookies are shared between HttpClient and WebDriver. E.g. pass cookie from WebDriver to HttpClient and vice versa.

    ReplyDelete
  2. Excellent Post. Also visit http://whiteboxqa.com/#selenium.php

    ReplyDelete
  3. Selenium training in Chennai
    We provide best selenium training in Chennai with real time scenarios.For real time training reach us 8122241286 and become experts in selenium.
    selenium training in chennai

    ReplyDelete

Post a Comment

Popular Posts