protected ClientCookie convertCookie ( Cookie browserCookie ) { BasicClientCookie cookie = new BasicClientCookie ( browserCookie . getName ( ) , browserCookie . getValue ( ) ) ; String domain = browserCookie . getDomain ( ) ; if ( domain != null && domain . startsWith ( "." ) ) { // http client does not like domains starting with '.', it always removes it when it receives them domain = domain . substring ( 1 ) ; } cookie . setDomain ( domain ) ; cookie . setPath ( browserCookie . getPath ( ) ) ; cookie . setExpiryDate ( browserCookie . getExpiry ( ) ) ; cookie . setSecure ( browserCookie . isSecure ( ) ) ; if ( browserCookie . isHttpOnly ( ) ) { cookie . setAttribute ( "httponly" , "" ) ; } return cookie ; }
Converts Selenium cookie to Apache http client .