Vcr: VCR not playing nice with Selenium (and Capybara)

Created on 9 Mar 2010  ·  5Comments  ·  Source: vcr/vcr

When I put a cassette tag on a Cucumber featured tagged with @javascript (causing Capybara to use the Selenium driver), strange things start happening...

The first time I run it, everything happens as expected: the cassette records, the data is used, and everything passes.

The next time I run it (off the cassette), it fails with Unregistered request: GET http://localhost:9887/identify.

It seems that Selenium needs to talk to its server using that port (pinging it to see if it exists, in this instance). I'm not precisely just sure how VCR is messing that up, but it is.

It would probably be useful to allow localhost requests through (either configurable or by an @allow_localhost tag, or both).

Most helpful comment

@clyfe -- I recommend you use the c.ignore_localhost = true config option instead; it's specifically intended for this.

All 5 comments

This should be resolved by 2ed9c3c318305ee39fa054997da1b67c1413a408.

I'm having the same problem on version 1.11.3, with rspec requests test with :js => true (capybara, selenium).

  • The first time I run it, everything happens as expected: the cassette records, the data is used, and everything passes.
  • The next time I run it (off the cassette), it fails with Unregistered request: GET http://localhost:9887/__identify__.

I got over this by setting c.allow_http_connections_when_no_cassette = true in some situations.

@clyfe -- I recommend you use the c.ignore_localhost = true config option instead; it's specifically intended for this.

@myronmarston Thanks for c.ignore_localhost = true, it helped me. But I wanted to record a local service. So first I recorded it and then changed host in the cassette.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krainboltgreene picture krainboltgreene  ·  16Comments

sdilshod picture sdilshod  ·  13Comments

Senjai picture Senjai  ·  5Comments

bblimke picture bblimke  ·  18Comments

rweng picture rweng  ·  6Comments