small medium large xlarge

Hat_pragsmall
07 Oct 2012, 13:29
Iain Wood (6 posts)

I’m following through chapter 8 and all seems to be working as expected except that the page saved and displayed by capybara (pg 150) is blank. If I point my browser at the page then I see the form as expected, but there is nothing on the saved page. I can reproduce this by using the sample code (code/support_code/18) and just making a simple change to the feature file so that the test fails. Any ideas what I can change to see the page as Capybarra sees it?

regards

Iain

Avatar_pragsmall
08 Oct 2012, 06:13
Matt Wynne (87 posts)

That’s puzzling.

Can you open the HTML file in an editor, or view source on it and see what it contains?

Hat_pragsmall
08 Oct 2012, 07:17
Iain Wood (6 posts)

Just a single line:

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” “http://www.w3.org/TR/REC-html40/loose.dtd”>

Avatar_pragsmall
08 Oct 2012, 10:14
Matt Wynne (87 posts)

Right.

My only guess is that there’s something wrong in your scenario such that Capybara hasn’t actually seen anything yet. Maybe you’re missing a call to @#visit@ somewhere?

One thing you could try is to add the ~~~ @javascript ~~~ tag to the scenario, which should cause it to open up in Firefox as it runs. That might give you some more clues as to what’s happening.

Hat_pragsmall
15 Oct 2012, 16:11
Iain Wood (6 posts)

I downloaded a fresh copy of support_code/18, edited the feature file so it would fail, and added the @ javascript tag. Firefox flashes up a window very briefly which looks like it contains the form as expected but the call to save_and_open_page just produces a blank page as before. All that is different from the original source is the first and last lines of the feature file. Here’s my version:

@javascript Feature: Cash Withdrawal Scenario: Successful withdrawal from an account in credit Given my account has been credited with $100 When I withdraw $20 Then $20 should be dispensed And the balance of my account should be $81

Me_small_pragsmall
16 Oct 2012, 08:59
Jon Rowe (1 post)

If this is a Javascript scenario then it sounds like a race condition between the driver and the “browser”. You could put a @sleep 1@ in before the @save_and_open_page@ and see if it affects the output, or you could put in a @debugger@ statement (requires the debugger or ruby-debug gems) and see what the @page.body@ is at that time (the debugger statement is generally slow enough to allow the page to finish loading)

Hat_pragsmall
18 Oct 2012, 16:11
Iain Wood (6 posts)

Thanks Jon. I will try this when I can get it working again. The new version of Firefox doesn’t seem to want to play with selenium so at the moment I can get no further than an error message saying “Unable to establish a stable firefox connection in 60 seconds” This looks like a recurring problem with selenium and new versions of firefox :-/

  You must be logged in to comment