Capybara-WebKit
This section is all about Capybara-webkit. The WebKit framework powers Chrome, Safari, and most mobile phone browsers. It’s a popular open source project and is really at the vanguard of web browsers.
The team at ThoughtBot, a Rails consultancy in Boston, put together the capybara-webkit gem: https://github.com/thoughtbot/capybara-webkit
It uses the WebKit framework as a headless browser. Certainly, we get almost all the speed of being headless with Rack::Test, but the power of a full, real-world JavaScript interpreter.
Nonetheless, this driver is for true headless testing. Not to mention, it uses QtWebKit to start a rendering engine process. Moreover, it can execute JavaScript as well. It is significantly faster than drivers like Selenium since it does not load an entire browser.
You can install it with:
gem install capybara-webkit
And you can use it by:
Capybara.javascript_driver = :webkit
Setup Qt
capybara-webkit uses the QtWebKit port, which depends on the Qt windowing framework. Even though the whole point is to run WebKit without windows, the compilation process has dependencies on Qt.
Because Qt is not available for Windows, it’s not possible to build WebKit for use with Capybara-Webkit on Windows. You’ll need OS X or Linux.
OS X users can download and install the non-debug Qt from Nokia here: http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x
Ubuntu users can sudo apt-get install libqt4-dev, while other Linux distributions can build it from Nokia’s source code: http://qt.nokia.com/downloads/linux-x11-cpp
Make your resume stand out and become a Certified Capybara Testing Professional. Try free practice tests here!
A great career is just a certification away. So, practice and validate your skills to become Certified Capybara Testing Professional