public void goToUrlWithCookie ( final String url , final String cookieName , final String cookieValue ) { // we'll do a trick to prevent Selenium falsely reporting a cross // domain cookie attempt LOG . info ( "Getting: " + url + " with cookieName: " + cookieName + " and cookieValue: " + cookieValue ) ; driver . get ( url + "/404.html" ) ; // this should display 404 not found driver . manage ( ) . deleteAllCookies ( ) ; driver . manage ( ) . addCookie ( new Cookie ( cookieName , cookieValue ) ) ; driver . get ( url ) ; }
Opens the specified URL using the specified cookie .