Re: session and path are nil in selenium-mode

3 views
Skip to first unread message

Curran Schiefelbein

unread,
Jun 19, 2010, 11:22:25 AM6/19/10
to web...@googlegroups.com
Hi all,

This is still driving me a little crazy, especially given the number
of webrat+selenium examples that contain the following line of code
(or similar):

# This is still an integration test, so we have access to the
# session state if we need it
assert_equal @user.id, session[:user], "Should have been logged in"

(cf http://blog.danielwellman.com/2008/06/writing-rails-integration-tests-with-webrat.html,
as Bryan Helmkamp's
http://www.brynary.com/2009/4/6/switching-webrat-to-selenium-mode
seems to be down today)

Can someone with a little experience please confirm whether there is a
way to access this information when using selenium, or whether it is
locked up inside the real browser and inaccessible to webrat and the
test code? I've been poking around in the source code; path is defined
(but evaluates to nil), @controller is nil, and session is just plain
an undefined method. In the working (non-selenium) webrat test,
session and @controller are both defined. Again -- is this normal, or
did I put together a broken webrat+selenium configuration?

thanks,
Curran


On Jun 6, 2:37 pm, Curran <c.schiefelb...@gmail.com> wrote:
> Hi,
>
> I'm trying to convert a simple user authentication test from rails
> mode (in which it passes) into selenium mode. The browser opens, goes
> to the right page, enters the right text in the right form... BUT some
> of the variables/methods available to the test in rails mode are not
> available in selenium mode, such as session and path. They evaluate to
> nil and the test breaks. Does anyone know why this might be happening?
>
> I haven't been able to find anything suggesting that the webrat api
> would change in the two different modes. But that's the only thing
> that's changed in my app. There's a concise example and my webrat
> config athttp://pastie.org/994056.
>
> Thanks,
> Curran

Reply all
Reply to author
Forward
0 new messages