I am trying to do some unit 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 to be able to set a session cookie instead of having to do this for every test.
I tried to do something like this
browser.webDriver.manage().addCookie( new Cookie("PLAY_SESSION",
"1dd6811c9df64e03a892f55f57dd0f1190656d88-email%3Amichele%40sample.com") )
but doesnt work out, as I get a null pointer exception when I try to retrieve the cookie using browser.getCookie("PLAY_SESSION").getValue()
must contain ("michele@sample.com")
Any help is greatly appreciated!!
由于michele@sample.com被转换为michele%40sample.com,因此请尝试使用michele%40sample.com而不是michele@sample.com
browser.getCookie("PLAY_SESSION").getValue() must contain("michele%40sample.com")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.