I am trying to do part of testing using selenium hd. I currently have the following code:
browser.goTo("http://localhost:3333/")
browser.$("#email").text("michele@sample.com")
browser.$("#password").text("secret")
browser.$("#loginbutton").click()
browser.goTo("http://localhost:3333/michele")
But I would like to be able to set a session cookie instead of doing this for each test.
I tried to do something like this
browser.webDriver.manage().addCookie( new Cookie("PLAY_SESSION",
"1dd6811c9df64e03a892f55f57dd0f1190656d88-email%3Amichele%40sample.com") )
but it doesn’t work, because I get an exception from the null pointer when I try to extract a cookie using browser.getCookie("PLAY_SESSION").getValue()must contain("michele@sample.com")
Any help is much appreciated!
source
share