public void goToUrlWithCookies ( final String url , final Map < String , String > cookieNamesValues ) { LOG . info ( "Getting: " + url + " with cookies: " + cookieNamesValues ) ; driver . get ( url + "/404.html" ) ; // this should display 404 not found driver . manage ( ) . deleteAllCookies ( ) ; Set < Entry < String , String > > entries = cookieNamesValues . entrySet ( ) ; for ( Entry < String , String > cookieEntry : entries ) { driver . manage ( ) . addCookie ( new Cookie ( cookieEntry . getKey ( ) , cookieEntry . getValue ( ) ) ) ; } driver . get ( url ) ; }
Opens the specified URL using the specified cookies list .