public void setCookie ( Cookie cookie ) { String domain = cookie . getDomain ( ) ; Date expiry = cookie . getExpiry ( ) ; String name = cookie . getName ( ) ; String path = cookie . getPath ( ) ; String value = cookie . getValue ( ) ; String action = "Setting up cookie with attributes:<div><table><tbody><tr><td>Domain</td><td>" + domain + "</tr><tr><td>Expiration</td><td>" + expiry . toString ( ) + "</tr><tr><td>Name</td><td>" + name + "</tr><tr><td>Path</td><td>" + path + "</tr><tr><td>Value</td><td>" + value + "</tr></tbody></table></div><br/>" ; String expected = "Cookie is added" ; try { driver . manage ( ) . addCookie ( cookie ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Unable to add cookie. " + e . getMessage ( ) ) ; log . warn ( e ) ; return ; } reporter . pass ( action , expected , expected ) ; }
Adds a cookie to the application for this particular test