Capybara(-webkit) thread safe

194 views
Skip to first unread message

Jon Doveston

unread,
Jul 20, 2012, 8:58:54 AM7/20/12
to capybar...@googlegroups.com
Is it possible to use capybara and capybara webkit concurrently in multiple threads on multiple external sites. (using Capybara.app_host)

Joe Ferris

unread,
Jul 20, 2012, 11:31:38 AM7/20/12
to capybar...@googlegroups.com
Hey Jon,

Capybara.app_host is a class variable that is both set and referenced globally, so multiple threads can't have multiple values for that. Other than that, you could easily build multiple instances of Capybara::Webkit::Driver or Capybara::Session. You could use your own mutex to synchronize setting the app_host and using #visit (which will reference app_host).

You may want to ask around the capybara mailing list, since I think the only thing you'll have to worry about is capybara's class variables.

-Joe

Aces1up

unread,
Aug 11, 2012, 3:58:42 AM8/11/12
to capybar...@googlegroups.com
How do sessions work in Capybara - WEbkit,  with sessions are you able to run more
than one browser per server?

Or on default can you run more than 1 browser per server already?

Joe Ferris

unread,
Aug 24, 2012, 1:20:08 PM8/24/12
to capybar...@googlegroups.com
Using multiple capybara sessions will boot multiple servers. You don't have to worry about thread safety between the different servers, because each runs in its own process, and capybara itself is thread safe on the driver side.
Reply all
Reply to author
Forward
0 new messages