Example usage for org.openqa.selenium Cookie isHttpOnly

List of usage examples for org.openqa.selenium Cookie isHttpOnly

Introduction

In this page you can find the example usage for org.openqa.selenium Cookie isHttpOnly.

Prototype

boolean isHttpOnly

To view the source code for org.openqa.selenium Cookie isHttpOnly.

Click Source Link

Usage

From source file:org.cerberus.service.engine.impl.WebDriverService.java

License:Open Source License

@Override
public String getFromCookie(Session session, String cookieName, String cookieParameter) {
    Cookie cookie = session.getDriver().manage().getCookieNamed(cookieName);
    if (cookie != null) {
        if (cookieParameter.equals("name")) {
            return cookie.getName();
        }/*  w  w  w  .j av a  2  s.  c om*/
        if (cookieParameter.equals("expiry")) {
            return cookie.getExpiry().toString();
        }
        if (cookieParameter.equals("value")) {
            return cookie.getValue();
        }
        if (cookieParameter.equals("domain")) {
            return cookie.getDomain();
        }
        if (cookieParameter.equals("path")) {
            return cookie.getPath();
        }
        if (cookieParameter.equals("isHttpOnly")) {
            return String.valueOf(cookie.isHttpOnly());
        }
        if (cookieParameter.equals("isSecure")) {
            return String.valueOf(cookie.isSecure());
        }
    } else {
        return "cookieNotFound";
    }
    return null;
}