Java Code Examples for org.openqa.selenium.remote.http.HttpRequest#getQueryParameter()

The following examples show how to use org.openqa.selenium.remote.http.HttpRequest#getQueryParameter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SleepingHandler.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public HttpResponse execute(HttpRequest req) throws UncheckedIOException {
  String duration = req.getQueryParameter("time");
  long timeout = Long.parseLong(duration) * 1000;

  reallySleep(timeout);

  return new HttpResponse()
    .setHeader("Content-Type", "text/html")
    //Dont Cache Anything  at the browser
    .setHeader("Cache-Control","no-cache")
    .setHeader("Pragma","no-cache")
    .setHeader("Expires", "0")
    .setContent(utf8String(String.format(RESPONSE_STRING_FORMAT, duration)));
}
 
Example 2
Source File: HttpClientTestBase.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldAddUrlParameters() {
  HttpRequest request = new HttpRequest(GET, "/query");
  String value = request.getQueryParameter("cheese");
  assertThat(value).isNull();

  request.addQueryParameter("cheese", "brie");
  value = request.getQueryParameter("cheese");
  assertThat(value).isEqualTo("brie");
}