【问题标题】:How to reset session of CAS using selenium如何使用 selenium 重置 CAS 会话
【发布时间】:2013-09-05 02:43:23
【问题描述】:

我的应用有 CAS 登录。当我使用 CAS 登录并通过 page.driver.browser.manage.all_cookies 找出所有使用 selenium 的 cookie 时,它​​只返回一个应用程序 cookie。不返回 CAS 的 cookie。

当我去 FF 时

Edit > Preference > remove individual cookies

一共有三个cookie,两个是CAS,一个是app。

当我运行 page.driver.browser.manage.delete_all_cookies 时,它只删除应用程序 cookie 而不是 CAS cookie。

是否可以删除 page.driver.browser.manage.all_cookies 未附带的 CAS cookie

【问题讨论】:

    标签: ruby cookies selenium selenium-webdriver session-cookies


    【解决方案1】:
    a = page.driver.browser.manage.all_cookies
    

    所有浏览器 cookie 都将作为哈希值存储在变量 a 中。

    a.each do |cookie|
      page.driver.browser.delete_cookie(cookie)
    end
    

    试试这个

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-30
      • 2018-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-30
      • 2022-10-12
      相关资源
      最近更新 更多