Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Ability to preload Selenium's browser #295
I made this quick patch to be able to spawn Firefox in the
It's quite simple:
then in tests the Selenium driver reuses the preloaded browser instead of creating a new one.
Upside: shave seconds off test startup time.
This goes well with running headless to background the browser; I initially planned to add it to the preloader as an option, but decided that's out of the driver's responsibility.
That's a great idea, though there's actually three serious-ish problems right now:
I actually think that the last issue Jo pointed out is quite serious. We can't preload the browser like this, because it's actually not a very realistic way of opening the browser. Considering that, I'm against this getting merged.
I played with Spork a bit recently, didn't really get it all to work, due to some database transaction issues. But I came up with something like:
Obviously this isn't something we can add to Capybara, since it's very specific to a particular application and to using Spork, but it's not a lot of code, and kind of a simple concept.
I'll close this for now, but I'm open for a continued discussion.
Well actually I ended up with about the same solution at first, but it didn't work out so well. Somewhy capybara doesn't reuse the browser after the fork.
I'll create a blank rails app and test the whole setup there.
Regarding the Ctrl+C issue: the problem is not
Ah, thanks for posting this, Jonas -- that's much better and simpler of course.
It still suffers from the problem that interrupting the client kills the browser, like the original patch, which makes it pretty unusable even as a hack.
In case anyone cares about pursuing this further:
It seems that when you interrupt the client, the browser is indeed getting yanked by the
Unrelatedly, I tried trapping SIGINT, and it doesn't work at all if I'm running spork, neither in the client nor in the server. (Without spork, it works fine.) I think Spork overrides the signal handler after I define it.
At this point, I'm not inclined to dig deeper, but I just thought I'd post this anyway in case someone else wants to.