硒IDE,deleteAllVisibleCookies和ASP.NET_SessionId的Cookie - 不工作 [英] Selenium IDE, deleteAllVisibleCookies and ASP.NET_SessionId Cookie - Not Working

查看:294
本文介绍了硒IDE,deleteAllVisibleCookies和ASP.NET_SessionId的Cookie - 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用硒IDE(1.3.0在FF 7.1)来创建一个测试用例。测试用例的目的是登录到ASP.NET应用程序,清除会话cookie(模拟超时或类似的东西),然后导航到登录的用户将看到默认页面,并验证它们转发到登录页面。 pretty简单......但我只是潜入硒IDE所以我想从简单开始。

I'm using Selenium IDE (1.3.0 on FF 7.1) to create a test case. The object of the test case is to log in to an ASP.NET application, clear the session cookie (to simulate a timeout or something similar) and then navigate to the default page the logged-in user sees, and verify that they are forwarded to the login page. Pretty simple ... but I'm just diving into Selenium IDE so I'm trying to start simple.

看起来 deleteAllVisibleCookies 是这样做的正确方法:

It seems like deleteAllVisibleCookies is the correct way to do this:

deleteAllVisibleCookies()
  调用deleteCookie用递归=真正的上
  所有Cookie到当前页面可见。由于文档上指出
  对于deleteCookie,递归=真正的可以比简单地删除慢得多
  使用已知的域/路径的cookie。

deleteAllVisibleCookies ( ) Calls deleteCookie with recurse=true on all cookies visible to the current page. As noted on the documentation for deleteCookie, recurse=true can be much slower than simply deleting the cookies using a known domain/path.

我的硒IDE计划的相关部分看起来是这样的:

The relevant part of my Selenium IDE plan looks something like this:

assertTitle                 Project List
assertTextPresent           Start a New Project
deleteAllVisibleCookies
open                        /path/to/intro/page.aspx
assertTitle                 Log In

在运行测试计划,我期待在通过FireCookie和萤火虫设置的cookie。

While running the test plan, I'm looking at the cookies set via FireCookie and Firebug.

一旦用户登录(在 assertText present 部分)我看到两个饼干 - ASP.NET_SessionId另有饼干,这两者的设置同一个域(domain.local)和路径(/).

Once the user is logged in (at the assertTextPresent part) I see two cookies - ASP.NET_SessionId and another cookie, both of which are set for the same domain (domain.local) and path (/).

deleteAllVisibleCookies 被调用时,我看到了第二个cookie被删除,但ASP.NET_SessionId不会被删除。

When deleteAllVisibleCookies is called, I see the second cookie get deleted, but ASP.NET_SessionId does not get deleted.

我试着加入暂停5000 deleteAllVisibleCookies 因为好像是在文档中的一些迹象表明,通过饼干递归的过程可能是耗时,但是这并没有帮助。

I've tried adding pause 5000 after deleteAllVisibleCookies since there seems to be some indication in the documentation that the process of recursing through the cookies may be time-consuming, but that hasn't helped.

我试着用 deleteAllVisibleCookiesAndWait 但只是超时并失败 - 我不是从文档完全肯定,如果我做错了那里,或者即使要被使用在这种情况下,正确的呼叫

I tried using deleteAllVisibleCookiesAndWait but that just times out and fails - I'm not entirely sure from the documentation if I'm doing something wrong there, or even if that is the right call to be using in this situation.

我失去了一些东西在这里?

Am I missing something here?

修改:我只想用 deleteCookie 通过递归选项,但我需要这个测试计划与各种基础URL来这么辛苦在-coding域,因为我需要做的 deleteCookie 不是一个选项。

Edit: I would just use deleteCookie with the recurse option but I need this test plan to work with a variety of Base URLs so hard-coding the domain in, as I'd need to do with deleteCookie is not an option.

编辑2 :我甚至无法获得指定的名称中删除会话cookie( ASP.NET_SessionId )和 =域domain.local,递归=真正的,PATH = / 的参数。

Edit 2: I can't even get the session cookie deleted by specifying the name (ASP.NET_SessionId) and domain=domain.local,recurse=true,path=/ for the arguments.

推荐答案

由于它被标记为这是不可能删除ASP.NET_SessionId的cookie的仅Http

It isn't possible to delete the ASP.NET_SessionId cookie because it is marked HttpOnly.

设置Cookie:ASP.NET_SessionId = zecwj145rv2wkt45ekwangyq;路径= /;仅Http

Set-Cookie:ASP.NET_SessionId=zecwj145rv2wkt45ekwangyq; path=/; HttpOnly

根据这个帖子没有反正删除或修改HTTP以外的饼干。此外,还有<一个href=\"http://stackoverflow.com/questions/2247143/how-is-httponly-get-set-for-asp-net-sessionid-cookie/2247221#2247221\">isn't一种方法来关闭的HttpOnly为此cookie 。

According to this post there isn't anyway to delete or modify the cookie other than HTTP. There also isn't a way to turn off HttpOnly for this cookie.

这篇关于硒IDE,deleteAllVisibleCookies和ASP.NET_SessionId的Cookie - 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆