Giter Club home page Giter Club logo

capybara-webkit's Introduction

capybara-webkit

Development has been suspended on this project because QtWebKit was deprecated in favor of QtWebEngine, which is not a suitable replacement for our purposes.

We instead recommend using the Selenium or Apparition drivers.

Qt Dependency and Installation Issues

capybara-webkit depends on a WebKit implementation from Qt, a cross-platform development toolkit. You'll need to download the Qt libraries to build and install the gem. You can find instructions for downloading and installing Qt on the capybara-webkit wiki. capybara-webkit requires Qt version 4.8 or greater.

CI

If you're like us, you'll be using capybara-webkit on CI.

On Linux platforms, capybara-webkit requires an X server to run, although it doesn't create any visible windows. Xvfb works fine for this. You can setup Xvfb yourself and set a DISPLAY variable, try out the headless gem, or use the xvfb-run utility as follows:

xvfb-run -a bundle exec rspec

This automatically sets up a virtual X server on a free server number.

Usage

Add the capybara-webkit gem to your Gemfile:

gem "capybara-webkit"

Set your Capybara Javascript driver to webkit:

Capybara.javascript_driver = :webkit

In cucumber, tag scenarios with @javascript to run them using a headless WebKit browser.

In RSpec, use the :js => true flag. See the capybara documentation for more information about using capybara with RSpec.

Take note of the transactional fixtures section of the capybara README.

If you're using capybara-webkit with Sinatra, don't forget to set

Capybara.app = MySinatraApp.new

Configuration

You can configure global options using Capybara::Webkit.configure:

Capybara::Webkit.configure do |config|
  # Enable debug mode. Prints a log of everything the driver is doing.
  config.debug = true

  # By default, requests to outside domains (anything besides localhost) will
  # result in a warning. Several methods allow you to change this behavior.

  # Silently return an empty 200 response for any requests to unknown URLs.
  config.block_unknown_urls

  # Allow pages to make requests to any URL without issuing a warning.
  config.allow_unknown_urls

  # Allow a specific domain without issuing a warning.
  config.allow_url("example.com")

  # Allow a specific URL and path without issuing a warning.
  config.allow_url("example.com/some/path")

  # Wildcards are allowed in URL expressions.
  config.allow_url("*.example.com")

  # Silently return an empty 200 response for any requests to the given URL.
  config.block_url("example.com")

  # Timeout if requests take longer than 5 seconds
  config.timeout = 5

  # Don't raise errors when SSL certificates can't be validated
  config.ignore_ssl_errors

  # Don't load images
  config.skip_image_loading

  # Use a proxy
  config.use_proxy(
    host: "example.com",
    port: 1234,
    user: "proxy",
    pass: "secret"
  )

  # Raise JavaScript errors as exceptions
  config.raise_javascript_errors = true
end

These options will take effect for all future sessions and only need to be set once. It's recommended that you configure these in your spec_helper.rb or test_helper.rb rather than a before or setup block.

Offline Application Cache

The offline application cache needs a directory to write to for the cached files. Capybara-webkit will look at if the working directory has a tmp directory and when it exists offline application cache will be enabled.

Non-Standard Driver Methods

capybara-webkit supports a few methods that are not part of the standard capybara API. You can access these by calling driver on the capybara session. When using the DSL, that will look like page.driver.method_name.

console_messages: returns an array of messages printed using console.log

// In Javascript:
console.log("hello")
# In Ruby:
page.driver.console_messages
=> [{:source=>"http://example.com", :line_number=>1, :message=>"hello"}]

error_messages: returns an array of Javascript errors that occurred

page.driver.error_messages
=> [{:source=>"http://example.com", :line_number=>1, :message=>"SyntaxError: Parse error"}]

cookies: allows read-only access of cookies for the current session

page.driver.cookies["alpha"]
=> "abc"

header: set the given HTTP header for subsequent requests

page.driver.header 'Referer', 'https://www.thoughtbot.com'

License

capybara-webkit is Copyright (c) 2010-2015 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

Thank you, contributors!

Code for rendering the current webpage to a PNG is borrowed from Phantom.js' implementation.

thoughtbot

capybara-webkit is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to help build your product.

capybara-webkit's People

Contributors

betelgeuse avatar carloslopes avatar cmeiklejohn avatar danivovich avatar eagletmt avatar foobarwidget avatar halogenandtoast avatar hotchpotch avatar j16r avatar jasonkarns avatar jferris avatar joankaradimov avatar joefiorini avatar jonrowe avatar joshuaclayton avatar marcisme avatar mhoran avatar mike-burns avatar mnutt avatar nicholaides avatar niklasb avatar nritholtz avatar os0x avatar rb2k avatar rectalogic avatar seangeo avatar sikachu avatar tomlea avatar tristandunn avatar twalpole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

capybara-webkit's Issues

Errno::EPIPE: Broken pipe

I sporadically get the following error:

Errno::EPIPE: Broken pipe
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:45:in `write'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:45:in `puts'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:45:in `command'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:18:in `find'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit.rb:28:in `find'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:156:in `find_in_base'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:121:in `block in all'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `map'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `all'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:38:in `block in has_selector?'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `block in wait_conditionally_until'
  capybara-0.4.1.2/lib/capybara/session.rb:222:in `block in wait_until'
  capybara-0.4.1.2/lib/capybara/util/timeout.rb:13:in `timeout'
  capybara-0.4.1.2/lib/capybara/session.rb:222:in `wait_until'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `wait_conditionally_until'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:37:in `has_selector?'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:121:in `has_xpath?'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:184:in `has_content?'
  capybara-0.4.1.2/lib/capybara/session.rb:264:in `method_missing'

I am running my acceptance specs in parallel, if that is relevant.

All Japanese char turn to ??????

OS
CentOS release 5.5 (Final)

rpm
qt.i386 1:3.3.6-23.el5 installed
qt4.i386 4.2.1-1 installed
xorg-x11-server-Xvfb.i386 1.1.1-48.76.el5 installed

gem
capybara (0.4.1.2)
capybara-webkit (0.1.5)

html page was encoded Utf-8
any solution?

Timeout when loading a URL containing a # hash / fragment identifier

In a step definition, this:

visit('/page#do-some-javascript')

completely fails to load anything, and doesn't even seem to time out (I got bored after > 5 minutes). Swapping in the :selenium driver makes the page work as expected. When I did finally kill the test run, I got the rather unhelpful error:

undefined method strip' for nil:NilClass (NoMethodError)`

I'm using cucumber 0.10.2, capybara-webkit 0.3.0 and capybara 0.4.1.2 on Ubuntu, but not too sure where to look for any more logging information.

Can't install gem (os x 10.6.7, ruby 1.9.2-p180)

Hello all,

I'm unable to install capybara-webkit on my macbookpro, either version 0.2.0 or 0.3.0, using Ruby 1.9.2. Using Ruby 1.8.7-REE it installs fine though. I have no clue what could be the problem.

This is the error message i get:

$ gem install capybara-webkit -v 0.2.0
Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
    ERROR: Failed to build gem native extension.

        /Users/rodrigo/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
cd src/ && /usr/bin/qmake /Users/rodrigo/.rvm/gems/ruby-1.9.2-p180@myfinance/gems/capybara-webkit-0.2.0/src/webkit_server.pro -spec /usr/local/Qt4.7/mkspecs/macx-g++ -o Makefile.webkit_server
cd src/ && make -f Makefile.webkit_server 
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o main.o main.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o WebPage.o WebPage.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Server.o Server.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Connection.o Connection.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Command.o Command.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Visit.o Visit.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Find.o Find.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Reset.o Reset.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Node.o Node.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o JavascriptInvocation.o JavascriptInvocation.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Url.o Url.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Source.o Source.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Evaluate.o Evaluate.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Execute.o Execute.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o FrameFocus.o FrameFocus.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ WebPage.h -o moc_WebPage.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_WebPage.o moc_WebPage.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Server.h -o moc_Server.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Server.o moc_Server.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Connection.h -o moc_Connection.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Connection.o moc_Connection.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Command.h -o moc_Command.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Command.o moc_Command.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Visit.h -o moc_Visit.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Visit.o moc_Visit.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Find.h -o moc_Find.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Find.o moc_Find.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Reset.h -o moc_Reset.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Reset.o moc_Reset.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Node.h -o moc_Node.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Node.o moc_Node.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ JavascriptInvocation.h -o moc_JavascriptInvocation.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_JavascriptInvocation.o moc_JavascriptInvocation.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Url.h -o moc_Url.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Url.o moc_Url.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Source.h -o moc_Source.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Source.o moc_Source.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Evaluate.h -o moc_Evaluate.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Evaluate.o moc_Evaluate.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ Execute.h -o moc_Execute.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_Execute.o moc_Execute.cpp
/Developer/Tools/Qt/moc -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ FrameFocus.h -o moc_FrameFocus.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o moc_FrameFocus.o moc_FrameFocus.cpp
/Developer/Tools/Qt/rcc -name webkit_server webkit_server.qrc -o qrc_webkit_server.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o qrc_webkit_server.o qrc_webkit_server.cpp
g++ -headerpad_max_install_names -o webkit_server.app/Contents/MacOS/webkit_server main.o WebPage.o Server.o Connection.o Command.o Visit.o Find.o Reset.o Node.o JavascriptInvocation.o Url.o Source.o Evaluate.o Execute.o FrameFocus.o moc_WebPage.o moc_Server.o moc_Connection.o moc_Command.o moc_Visit.o moc_Find.o moc_Reset.o moc_Node.o moc_JavascriptInvocation.o moc_Url.o moc_Source.o moc_Evaluate.o moc_Execute.o moc_FrameFocus.o qrc_webkit_server.o   -F/Library/Frameworks -L/Library/Frameworks -framework QtWebKit -framework QtGui -L/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -F/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -framework QtNetwork -framework QtCore 
ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -L not found
ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -F not found


Gem files will remain installed in /Users/rodrigo/.rvm/gems/ruby-1.9.2-p180@myfinance/gems/capybara-webkit-0.2.0 for inspection.
Results logged to /Users/rodrigo/.rvm/gems/ruby-1.9.2-p180@myfinance/gems/capybara-webkit-0.2.0/./gem_make.out

Version 0.3.0 produces the same error.

I'm running OS X 10.6.7, RVM 1.6.5, Ruby 1.9.2-p180, gcc 4.2.1, XCode 3.2.5, Qt 4.7.0, QMake 2.01a.

Anyone experience the same or similar issue?

Thanks a lot.

Handle Redirects Via Standard Rails Integration Tests?

Joe,

This is less of a solid issue with a patch that I would normally do for an OS project and more of a support forum request. So in advance, thanks for your time.

I am looking into using capybara-webkit for my vanilla rails integration tests and ran into a few issues. All problems occur when I redirect in a controller using the url helpers like users_url. This by default would generate a URL like so "http://www.example.com/users". I monkey patched ActionController::Integration::Session#reset! to return "127.0.0.1" for the host (in rails 2.3.8) and now while under test my _url helper methods will generate redirects like this. "http://127.0.0.1/users".

The problem that I am seeing is when webkit-server get's this redirect (absent a port), it would not follow a redirect back to application under test. How is capybara-webkit being used in other testing setup's and/or what is the convention by base capybara that resolves this? The port being used by webkit-server seems to be different for each run thru my integration test. So there is no way I can monkey patch default_url_options or something to include that host to make my controller redirects followable.

Perhaps there is a more elegant solution? Thoughts?

NoMethodError: undefined method `strip' for nil:NilClass

I get the following error sporadically:

NoMethodError: undefined method `strip' for nil:NilClass
    capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:84:in `check'
    capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:50:in `command'
    capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:18:in `find'
    capybara-webkit-0.4.0/lib/capybara/driver/webkit.rb:28:in `find'
    capybara-0.4.1.2/lib/capybara/node/finders.rb:156:in `find_in_base'
    capybara-0.4.1.2/lib/capybara/node/finders.rb:121:in `block in all'
    capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `map'
    capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `all'
    capybara-0.4.1.2/lib/capybara/node/matchers.rb:38:in `block in has_selector?'
    capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `block in wait_conditionally_until'
    capybara-0.4.1.2/lib/capybara/session.rb:222:in `block in wait_until'
    capybara-0.4.1.2/lib/capybara/util/timeout.rb:13:in `timeout'
    capybara-0.4.1.2/lib/capybara/session.rb:222:in `wait_until'
    capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `wait_conditionally_until'
    capybara-0.4.1.2/lib/capybara/node/matchers.rb:37:in `has_selector?'
    capybara-0.4.1.2/lib/capybara/node/matchers.rb:121:in `has_xpath?'
    capybara-0.4.1.2/lib/capybara/node/matchers.rb:184:in `has_content?'
    capybara-0.4.1.2/lib/capybara/session.rb:264:in `method_missing'

This is probably masking a deeper issue, but the immediate fix is to add a to_s call to gets before calling strip.
I run my tests in parrallel, which may be related.

undefined method `switch_to' for Capybara::Driver::Webkit::Browser (NoMethodError)

Hi, we have a help button on our site, that opens the 'help' window. So to be able to check, we need to switch windows. Before, using selenium we needed to do something like:

page.driver.browser.switch_to.window('online_manuals')

But then i get the error that the method switch_to is not defined.

I am happy to add that, if that is possible. I just have no clue where to start. If somebody is willing to give me some pointers, i am willing to take a shot at it.

does attach_file work?

Hi all!

I'm moving a project from capybara (with firefox) to capybara-webkit. Everything works except attach_file. It simply doesn't fill the field on the form.

I use attach_file 'filed_id', file_path

Anyone had similar problems? Thank you!

jscript error, jQuery 1.5.1

Hi, thank you for this driver, I hope I can replace our selenium based steps!

With a jQuery 1.5.1 based script I get this error:

........undefined:1 ReferenceError: Can't find variable: $
F--.....

(::) failed steps (::)

Javascript failed to execute (Capybara::Driver::Webkit::WebkitError)
./features/step_definitions/landing_steps.rb:40:in /I leave the "(.+)" input field/' features/landing_page.feature:19:inAnd I leave the email input field'

The step definition is as follows

page.execute_script("$('input##{name}').trigger('DOMActivate').change().focusout();")

The script itself should be OK and runs with selenium/akehalos.
I see that this is not a lot if information - I'd be happy if you could ask for more specific things or point me to a direction.
--Frank

No such file or directory - src/webkit_server

Can't install capybara-webkit on Ubuntu 11

gem install capybara-webkit
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.

    /home/danil/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb

make: *** No rule to make target qmake'. Stop. make: *** No targets specified and no makefile found. Stop. /home/danil/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/fileutils.rb:1207:instat': No such file or directory - src/webkit_server (Errno::ENOENT)

localStorage is null (rather than undefined)

As explained here, localStorage is null rather than undefined within capybara-webkit.

Also, attempting to assign anything to window.localStorage fails silently:

console.log(window.localStorage); // null
window.localStorage = MyCustomStorage; // no exception
console.log(window.localStorage); // still null

Since I have not managed to reproduce this issue in Firefox or Chrome (on Ubuntu), it appears this might be specific to capybara-webkit. (Though I did find an old reference to a similar issue in Safari, at least with regards to the exception being thrown there.)

Can you confirm this issue or provide pointers regarding further investigation?

Add some linux instructions

This gem requires the ubuntu package libqt4-dev to be installed in the system, and so it's important that be included in the README.

Thanks for the awesome work!

Couldn't install capybara-webkit: g++: error: unrecognized option '-h'

I tried to install capybara-webkit and get an error:

$ LANG=en_EN gem install capybara-webkit
    Building native extensions.  This could take a while...
    ERROR:  Error installing capybara-webkit:
        ERROR: Failed to build gem native extension.

    /home/petrushka/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
    cd src/ && /usr/bin/qmake /home/petrushka/.rvm/gems/ruby-1.8.7-p302/gems/capybara-webkit-0.2.0/src/webkit_server.pro -spec /usr/share/qt/mkspecs/macx-g++ -o Makefile.webkit_server
    cd src/ && make -f Makefile.webkit_server 
    make[1]: Entering directory `/home/petrushka/.rvm/gems/ruby-1.8.7-p302/gems/capybara-webkit-0.2.0/src'
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o main.o main.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o WebPage.o WebPage.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Server.o Server.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Connection.o Connection.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Command.o Command.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Visit.o Visit.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Find.o Find.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Reset.o Reset.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Node.o Node.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o JavascriptInvocation.o JavascriptInvocation.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Url.o Url.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Source.o Source.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Evaluate.o Evaluate.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o Execute.o Execute.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o FrameFocus.o FrameFocus.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ WebPage.h -o moc_WebPage.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_WebPage.o moc_WebPage.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Server.h -o moc_Server.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Server.o moc_Server.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Connection.h -o moc_Connection.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Connection.o moc_Connection.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Command.h -o moc_Command.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Command.o moc_Command.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Visit.h -o moc_Visit.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Visit.o moc_Visit.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Find.h -o moc_Find.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Find.o moc_Find.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Reset.h -o moc_Reset.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Reset.o moc_Reset.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Node.h -o moc_Node.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Node.o moc_Node.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ JavascriptInvocation.h -o moc_JavascriptInvocation.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_JavascriptInvocation.o moc_JavascriptInvocation.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Url.h -o moc_Url.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Url.o moc_Url.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Source.h -o moc_Source.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Source.o moc_Source.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Evaluate.h -o moc_Evaluate.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Evaluate.o moc_Evaluate.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ Execute.h -o moc_Execute.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_Execute.o moc_Execute.cpp
    /usr/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -D__APPLE__ -D__GNUC__ FrameFocus.h -o moc_FrameFocus.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o moc_FrameFocus.o moc_FrameFocus.cpp
    /usr/bin/rcc -name webkit_server webkit_server.qrc -o qrc_webkit_server.cpp
    g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/macx-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtWebKit -I/usr/include -I. -o qrc_webkit_server.o qrc_webkit_server.cpp
    g++ -headerpad_max_install_names -o webkit_server.app/Contents/MacOS/webkit_server main.o WebPage.o Server.o Connection.o Command.o Visit.o Find.o Reset.o Node.o JavascriptInvocation.o Url.o Source.o Evaluate.o Execute.o FrameFocus.o moc_WebPage.o moc_Server.o moc_Connection.o moc_Command.o moc_Visit.o moc_Find.o moc_Reset.o moc_Node.o moc_JavascriptInvocation.o moc_Url.o moc_Source.o moc_Evaluate.o moc_Execute.o moc_FrameFocus.o qrc_webkit_server.o    -L/usr/lib -lQtWebKit -lQtGui -lQtNetwork -lQtCore 
    g++: error: unrecognized option '-h'
    make[1]: *** [webkit_server.app/Contents/MacOS/webkit_server] Error 1
    make[1]: Leaving directory `/home/petrushka/.rvm/gems/ruby-1.8.7-p302/gems/capybara-webkit-0.2.0/src'
    make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2

    make
    cd src/ && make -f Makefile.webkit_server 
    make[1]: Entering directory `/home/petrushka/.rvm/gems/ruby-1.8.7-p302/gems/capybara-webkit-0.2.0/src'
    g++ -headerpad_max_install_names -o webkit_server.app/Contents/MacOS/webkit_server main.o WebPage.o Server.o Connection.o Command.o Visit.o Find.o Reset.o Node.o JavascriptInvocation.o Url.o Source.o Evaluate.o Execute.o FrameFocus.o moc_WebPage.o moc_Server.o moc_Connection.o moc_Command.o moc_Visit.o moc_Find.o moc_Reset.o moc_Node.o moc_JavascriptInvocation.o moc_Url.o moc_Source.o moc_Evaluate.o moc_Execute.o moc_FrameFocus.o qrc_webkit_server.o    -L/usr/lib -lQtWebKit -lQtGui -lQtNetwork -lQtCore 
    g++: error: unrecognized option '-h'
    make[1]: *** [webkit_server.app/Contents/MacOS/webkit_server] Error 1
    make[1]: Leaving directory `/home/petrushka/.rvm/gems/ruby-1.8.7-p302/gems/capybara-webkit-0.2.0/src'
    make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2


    Gem files will remain installed in /home/petrushka/.rvm/gems/ruby-1.8.7-p302/gems/capybara-webkit-0.2.0 for inspection.
    Results logged to /home/petrushka/.rvm/gems/ruby-1.8.7-p302/gems/capybara-webkit-0.2.0/gem_make.out

Same results on 1.8.7 and 1.9.2
Arch linux, qt installed

g++ vesrion:

  $ LANG=en_EN g++ -v
  Using built-in specs.
  COLLECT_GCC=g++
  COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
  Target: x86_64-unknown-linux-gnu
  Configured with: /build/src/gcc-4.6-20110415/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --disable-multilib --disable-libstdcxx-pch --enable-checking=release
  Thread model: posix
  gcc version 4.6.0 20110415 (prerelease) (GCC) 

.all([...]).each seems to have problems

I'm trying a basic example:

        page.all(:xpath, "//ul[@class='menu']/li").each do |item|
            puts "#{item.inspect}: #{item.text}"
        end

or

        page.all(:css, "ul.menu li").each do |item|
            puts "#{item.inspect}: #{item.text}"
        end

This results in:

capybara-webkit-0.1.5/lib/capybara/driver/webkit/node.rb:59:in `path': uninitialized constant Capybara::Driver::Webkit::Node::NotSupportedByDriverError (NameError)

Is this a limitation of webkit?

Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL http://127.0.0.1 :53501/

Hi,

occasionally I get this errors and the follow ups (see below). This would be a timing problem I guess, but I don't know where to add some delays. Thank you for any hints on this!
--Frank

....Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL http://127.0.0.1
:53501/. Domains, protocols and ports must match.

.F---F.F---F.F-F.F--F.F--F

(::) failed steps (::)

undefined method strip' for nil:NilClass (NoMethodError) ./features/step_definitions/web_steps.rb:28:in/^(?:|I )am on (.+)$/'
features/landing_page.feature:17:in `Given I visit the signup page'

Broken pipe (Errno::EPIPE)
./features/step_definitions/web_steps.rb:28:in /^(?:|I )am on (.+)$/' features/landing_page.feature:24:inGiven I visit the signup page'

Cannot Install make: *** No rule to make target `qmake'. Stop.

When running bundle install i get the following error

Installing capybara-webkit (0.2.0) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
make: *** No rule to make target `qmake'.  Stop.
make: *** No targets specified and no makefile found.  Stop.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1200:in `stat': No such file or directory - src/webkit_server (Errno::ENOENT)
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1200:in `lstat'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1178:in `stat'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1260:in `copy_file'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:463:in `copy_file'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:383:in `cp'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1409:in `fu_each_src_dest0'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1393:in `fu_each_src_dest'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:382:in `cp'
    from /Library/Ruby/Gems/1.8/gems/capybara-webkit-0.2.0/lib/capybara_webkit_builder.rb:22:in `build'
    from /Library/Ruby/Gems/1.8/gems/capybara-webkit-0.2.0/lib/capybara_webkit_builder.rb:29:in `build_all'
    from extconf.rb:2


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/capybara-webkit-0.2.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/capybara-webkit-0.2.0/gem_make.out
    from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `each'
    from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `build_extensions'
    from /Library/Ruby/Site/1.8/rubygems/installer.rb:198:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/bin/bundle:13
    from /usr/bin/bundle:19:in `load'
    from /usr/bin/bundle:19

Any ideas?

integration test hangs with QCoreApplication::postEvent

I'm using capybara-webkit with plain test::unit and sometimes my testsuite just hangs.

~/projects/loftville> rake test
(in /Users/dennis/projects/loftville)
Loaded suite /Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.QCoreApplication::postEvent: Unexpected null receiver

If I kill it here with CTRL-C I get:

^CEE
Finished in 21.137757 seconds.

  1. Error:
    test_sign_in_with_email_and_password(LoginWithEmailAndPasswordTest):
    Capybara::Driver::Webkit::WebkitError: Unknown command: sign_in_link')) or contains(./@title, 'sign_in_link')) or .//img[contains(./@alt, 'sign_in_link')])]Find
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-webkit-0.2.0/lib/capybara/driver/webkit/browser.rb:87:in `check'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-webkit-0.2.0/lib/capybara/driver/webkit/browser.rb:50:in `command'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-webkit-0.2.0/lib/capybara/driver/webkit/browser.rb:18:in `find'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-webkit-0.2.0/lib/capybara/driver/webkit.rb:28:in `find'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:156:in `find_in_base'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:143:in `block in first'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:142:in `each'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:142:in `first'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:28:in `block in find'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `block in wait_conditionally_until'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/session.rb:222:in `block in wait_until'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/util/timeout.rb:13:in `timeout'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/session.rb:222:in `wait_until'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `wait_conditionally_until'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:28:in `find'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/node/actions.rb:14:in `click_link_or_button'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/session.rb:264:in `method_missing'
/Users/dennis/.rvm/gems/ruby-1.9.2-p180@loftville/gems/capybara-0.4.1.2/lib/capybara/dsl.rb:104:in `click_on'
/Users/dennis/projects/loftville/test/integration_test_helper.rb:29:in `sign_in_user'
test/integration/login_with_email_and_password_test.rb:9:in `block in <class:LoginWithEmailAndPasswordTest>'

Versions:
capybara (0.4.1.2)
capybara-webkit (0.2.0)
rails (3.0.7)
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]

let me know if I can provide more info. And thanks for the great work with capybara-webkit!

Rendering page as PNG or PDF

I think one of the advantage of using QT Webkit is that it can render the current page as a PNG or PDF. A while ago I forked the project and added a "render" method to the driver that does just that (nicholaides@eabc7b2). I pretty much swiped it from the Phantom.js project.

Would this be an appropriate addition to capybara-webkit? If so, what sort of tests would be necessary?

If not, does anyone have any ideas how another module or gem could be made that adds this functionality, yet takes advantage of the code in this project?

.checked?() is not implemented yet

I get a NotImplementedError when using .checked? with capybara-webkit 0.2.0
--> /.rvm/gems/ruby-1.8.7-p330/gems/capybara-0.4.1.2/lib/capybara/driver/node.rb:52:in `checked?'

Cheers,
Marc

visit '/site#something' freezes webkit_server

Each time I attempt to user Capybara's 'visit' method using a '#' in the url (e.g. "/blog#title-of-a-post"), webkit_server freezes entirely. Disabling capybara-webkit eliminates the problem. I can't seem to find a way to debug it. My default driver is Culerity, but I confirmed that this is failing with Capybara's default driver as well. Any thoughts?

Capybara::TimeoutError in random time

Periodically I get an error Capybara::TimeoutError when I run full cucumber suite. I think error appears in 50% of runs.

  (::) failed steps (::)

  Capybara::TimeoutError (Capybara::TimeoutError)
  ./features/step_definitions/web_steps.rb:24:in `/^(?:|I )go to (.+)$/'
  features/manage_admin_hotels.feature:10:in `And I authenticate as "[email protected]" with password "password"'

  Failing Scenarios:
  cucumber features/manage_admin_hotels.feature:35 # Scenario: Adding new hotel

And is it always ok when I run only cucumber features/manage_admin_hotels.feature

  @javascript
  Scenario:
    Given the following "confirmed" users:
      | email            |role   |
      | [email protected] | admin |
    And I authenticate as "[email protected]" with password "password
    ...

I use Rails 3.0.7, capybara-webkit 0.2.0

Failure when @socket.gets is nil

In lib/capybara/driver/webkit/browser.rb of 0.1.6:

def check
  result = @socket.gets.strip

  unless result == 'ok'
    raise WebkitError, read_response
  end
end

When @socket.gets is nil you get a NoMethodError. The subsequent tests all fail with Errno::EPIPE: Broken pipe.

I don't know enough about what's happening here to debug much further so any suggestions would be appreciated.

Suggestion: More clarity re: install

You say: "If you're on OS X, the installer at the above link will set up everything you need. You can download just the framework, as the full SDK isn't required to build the gem." Uh, OK. Which? The first set of downloads on the page (described as "cross-platform application framework" but also "Qt SDK") OR the Qt Library, which for Mac OSX at least is a different page (http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x).

Meanwhile, the Qt bin directory (I used QtSDK/Simulator/Qt/gcc/bin) needs to be on the path to get at qmake. Doubtless the Qt docs say this somewhere.

Any logs from webkit_server?

Currently I'm trying to get capybara / capybara-webkit running on our Linux (gentoo) CI server.

I believe there is a problem started the server by capybara, but I'm not finding my logging data to help me debug it.

If I run my tests or the spec from capybara-webkit I get a similar result:

DISPLAY=:99.0 rake spec

/usr/lib/rubyee/gems/1.8/gems/capybara-0.4.1.2/lib/capybara/util/timeout.rb:17:in timeout': Capybara::TimeoutError (Capybara::TimeoutError) from /usr/lib/rubyee/gems/1.8/gems/capybara-webkit-0.2.0/lib/capybara/driver/webkit/browser.rb:72:inconnect'
from /usr/lib/rubyee/gems/1.8/gems/capybara-webkit-0.2.0/lib/capybara/driver/webkit/browser.rb:10:in initialize' from /usr/lib/rubyee/gems/1.8/gems/capybara-webkit-0.2.0/spec/spec_helper.rb:21:innew'
from /usr/lib/rubyee/gems/1.8/gems/capybara-webkit-0.2.0/spec/spec_helper.rb:21
from /usr/lib/rubyee/gems/1.8/gems/capybara-webkit-0.2.0/spec/driver_spec.rb:1:in `require'
from /usr/lib/rubyee/gems/1.8/gems/capybara-webkit-0.2.0/spec/driver_spec.rb:1

Does the webkit_server put out any logs? Any ideas on how I can find out what is preventing the server from starting? Thanks.

Not Waiting for Result of AJAX Request

I've got a link that when clicked makes a GET request, populates a div on the page, and renders a modal window from that div. I want to interact with the contents of that newly populated div/modal. With the akephalos driver the test passed with the default wait time of 2 seconds. With the capybara-webkit driver, I have to put a sleep 1 in my test before I try to interact with the content populated via the javascript, it works with capybara-webkit.

How can I make capybara-webkit wait long enough without having to use sleep?

Gem build error under 1.9.2-p180, can't find rake

I can install the gem under 1.8.7 ok, but 1.9.2 throws this error:

% gem install capybara-webkit
Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
    ERROR: Failed to build gem native extension.

        /Users/steve/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
/Users/steve/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:408:in `bin_path': can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
    from /Users/steve/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'


Gem files will remain installed in /Users/steve/.rvm/gems/ruby-1.9.2-p180/gems/capybara-webkit-0.1.6 for inspection.
Results logged to /Users/steve/.rvm/gems/ruby-1.9.2-p180/gems/capybara-webkit-0.1.6/./gem_make.out

A reinstall of rake didn't help.

I can run rake build BUILD=true and it builds ok.

Thanks
Steve

.rvmrc on root path makes build to fail on 1.9.2

It complains about missing gems because rvm automatically switches to 1.8 when building the gem (and I'm on 1.9).
Removing the file, switching back to 1.9 and executing ruby extconf.rb again fixes it.

javascript errors - getting them programatically

It would be nice if we had an option of getting js errors programatically. Better yet, it would be nice if there was a setting where you could have it throw an exception in ruby if one was raised in the js.

Driver doesn't like ajax clicks

I have a spec that passes when I use akephalos but fails using capybara-webkit.
Here's the gist of the scenario:

On the dashboard (logged in), if you delete a widget (link_to :method => delete, :remote => true...) then the event listener in coffeescript kinda like

$('.widgets a[data-method="delete"]').ajaxSuccess (event, xhr, settings) ->
# do some stuff
.ajaxError ->
  alert "Borked"

should capture the successful deletion. However, capybara-webkit fails and I get an alert message "Borked". Manually testing this scenario confirms it works, as does running it with Akephalos. Sorry if this is a bit vague, but I can't easily extract an example from my client's app. Please let me know what info I can provide to help out. I'd love to switch to capybara-webkit. Saves ~ 30 seconds on each run over Akephalos!

Autocomplete inputs

When using selenium (or even culerity) I can simply fill_in fields with strings and the jquery ui autocomplete fields will trigger the proper events to make the right ajax calls. I can then properly find the right links and click them to select which autocomplete result I want.

Unfortunately, all these tests fail with capybara-webkit. I tried manually triggering the right events, but I get Capybara::NotsupportedByDriverError when doing find("#id").trigger("focus") and also page.evaluate_javascript("$('#id').focus();").

BTW, I'm running with JRuby 1.6.1

installs fine but appears to have an issue starting rack integration

I'm trying out capybara-webkit (trying to, anyway) and running into an issue starting the test. When it gets past my data set up, I'm getting the following message:

Rack application timed out during boot

And a subsequent error during the first step of the test that utilizes anything on the page.

Any idea where I should start looking to get more information or start debugging the issue? This app is on Ruby 1.8.7, Rails 2.3.8, and the test passes using selenium with Capybara 0.4.1.

Is there an aim to be compatible with the Selenium driver?

I've started porting our test suite from Cucumber/Firewatir to Cucumber/Capybara. The selenium driver works really nicely.

We eventually want to use this gem, so that things run tons quicker.

Sadly, a fully green test suite on the selenium driver is failing when we switch to the webkit driver. Infact, over 50% of the specs that work in selenium are failing in webkit. "11 scenarios (6 failed, 5 passed)"

Any chance that the webkit API could be compatible with the selenium one?

Errors I get, that work in selenium, but fail in webkit include:

undefined method `to_xpath' for #<Capybara::Element tag=""> (NoMethodError)

Capybara::TimeoutError (Capybara::TimeoutError)

Unable to find './/*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')][((./@id = 'user_email' or ./@name = 'user_email') or ./@id = //label[normalize-space(string(.)) = 'user_email']/@for)] | .//label[normalize-space(string(.)) = 'user_email']//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')] | .//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')][((./@id = 'user_email' or ./@name = 'user_email') or ./@id = //label[contains(normalize-space(string(.)), 'user_email')]/@for)] | .//label[contains(normalize-space(string(.)), 'user_email')]//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]' (Capybara::ElementNotFound)

The syntax is very basic, using what is available on the Capybara gem Readme and RDoc, so I come here because I'm guessing it's an API compatibility issue.

Are you aware of these issues, or does the webkit driver work the same as selenium for you and thus you don't get the errors I'm seeing? Maybe the version of QT is too new (just installed on Friday last week).

Any ideas?

Can't redirect to a secure port

I'm seeing this error when running with capybara-webkit: Unable to load URL: http://127.0.0.1:9887/authentication/login (Capybara::Driver::Webkit::WebkitError)

We're doing something that's arguably a little odd in our app. To verify that login is all done via HTTPS, when we run our tests via Cucumber we spin up a second HTTPS Rails process on port 9888, and all auth requests are 302'd to that port. So our login URL should be https://127.0.0.1:9888/authentication/login.

There are a few things about this that typically cause problems with headless browsers (the separate port, a self-signed certificate) but it looks like we're not even getting as far as those, because capybara-webkit isn't following the 302 from port 9887 to port 9888.

Any idea what might be going wrong or how we could fix this?

Thanks for building this, I've been trying to get a headless browser going for months.

within block fails when it shouldn't, unless selector exercised first

I haven't completely pinned down everything necessary to reproduce this. But it occurs for us when we use standard web_step

Then I should see "xxxx" within "#yyyy"

(it doesn't matter whether the selector is :css :xpath)

capybara-webkit will spit out a couple dozen

NOT_SUPPORTED_ERR: DOM Exception 9: The implementation did not support the requested type of object or operation.

and then the has_content? part will fail.

I discovered that if I change the with_scope method in web_steps as follows:

module WithinHelpers
  def with_scope(locator)
    page.find(*selector_for(locator)).should_not be_nil # note: this line makes "within" steps work with capybara-webkit, otherwise they fail.
    locator ? within(*selector_for(locator)) { yield } : yield
  end
end

other things which trigger generation of the whole html, or the element that is to be the parent of the within, for example, adding a "show me the page" step before calling with_scope will also work. So I expect it is a timing and / or lazy evaluation issue somewhere, but because the capybara within code is very deeply nested I bailed before finding the exact cause of the problem, since the workaround solved my immediate issue.

Can't install gem

$ gem install capybara-webkit
Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
ERROR: Failed to build gem native extension.

    /Users/oriol/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
    /Users/oriol/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:407:in `bin_path': can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
    from /Users/oriol/.rvm/gems/ruby-1.9.2-p180@global/bin/rake:19:in `<main>'


Gem files will remain installed in /Users/oriol/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.5 for inspection.
Results logged to /Users/oriol/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.5/./gem_make.out

Using rubygems 1.7.2 (also tried with 1.7.1) and qt installed with homebrew (and rake is installed)

Merge master into 1.0 branch

There's been some great changes made to the master branch since the 1.0 branch was forked. Can update the 1.0 branch with what's put in the master branch?

[Install problem] - No such file or directory => /bin/sh: line 0: cd: src/:

Here's the log from my attempt to get bundler to install the gem after installing Qt. FYI, my system is osx 10.6.7 with rvm ruby 1.8.7.

less /usr/local/rvm/gems/ruby-1.8.7-p334/gems/capybara-webkit-0.3.0/./gem_make.out

/usr/local/rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
cd src/ && /usr/bin/qmake /usr/local/rvm/gems/ruby-1.8.7-p334/gems/capybara-webkit-0.3.0/src/webkit_server.pro -spec /usr/local/Qt4.7/mkspecs/macx-g++ -o Makefile.webkit_server
/bin/sh: line 0: cd: src/: No such file or directory
make: *** [sub-src-webkit_server-pro-qmake_all] Error 1

make
cd src/ && /usr/bin/qmake /usr/local/rvm/gems/ruby-1.8.7-p334/gems/capybara-webkit-0.3.0/src/webkit_server.pro -spec /usr/local/Qt4.7/mkspecs/macx-g++ -o Makefile.webkit_server
/bin/sh: line 0: cd: src/: No such file or directory
make: *** [src/Makefile.webkit_server] Error 1

Tests running very slow on Linux

I'm using capybara-webkit 0.2.0 with RSpec 2.5.0 (in a Rails 3.0.7 app). Tests that take 13 seconds to run on OS X take 70 seconds to run on Ubuntu, either in a desktop with full X server or in a server with Xvfb. The hardware is very similar between all computers, and there's no noticeable difference in performance running other (not capybarazied) specs...

I've got no clue as to what may be causing this slowness... Anyone experiencing similar symptoms?

Problem with jQuery & live('change')

I have a form with a checkbox. Checking,unchecking the the box submits the form: Here's the JS:

$(function(){
  // make the finish todo form submit when the box is checked
  $('form.todo.finish input[type=checkbox]').live('change', function() {
    $(this).closest('form').submit();
    return true;
  });
});

The turns out, that event handler is not executed with capybara-webkit, but it does pass in selenium.

Here's the step:

within "form#{dom_id(todo, :edit)}.todo.finish" do
  check 'todo_finished'
end

Odd installation failure in 192 and 187 on Snow Leopard

Trying to install the gem, I downloaded/installed Qt, tried installing the gem on 1.9.2-p180 got this:

GET http://rubygems.org/latest_specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://gems.github.com/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/specs.4.8.gz
200 OK
GET http://gems.github.com/specs.4.8.gz
200 OK
Installing gem capybara-webkit-0.1.4
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/.gitignore
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/.rspec
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/.rvmrc
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/Gemfile
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/Gemfile.lock
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/LICENSE
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/README.md
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/Rakefile
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/capybara-webkit.gemspec
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/extconf.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/lib/capybara-webkit.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/lib/capybara/driver/webkit.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/lib/capybara/driver/webkit/browser.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/lib/capybara/driver/webkit/node.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/spec/driver_spec.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/spec/integration/driver_spec.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/spec/integration/session_spec.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/spec/spec_helper.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/spec/support/socket_debugger.rb
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Command.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Command.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Connection.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Connection.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Evaluate.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Evaluate.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Execute.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Execute.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Find.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Find.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/JavascriptInvocation.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/JavascriptInvocation.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Node.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Node.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Reset.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Reset.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Server.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Server.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Source.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Source.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Url.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Url.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Visit.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/Visit.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/WebPage.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/WebPage.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/capybara.js
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/find_command.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/main.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/webkit_server.pro
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/src/webkit_server.qrc
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/templates/Command.cpp
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/templates/Command.h
/Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/webkit_server.pro
Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
    ERROR: Failed to build gem native extension.

                /Users/drmanitoba/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
/Users/drmanitoba/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:388:in `bin_path': can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
    from /Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'


Gem files will remain installed in /Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4 for inspection.
Results logged to /Users/drmanitoba/.rvm/gems/ruby-1.9.2-p180@global/gems/capybara-webkit-0.1.4/./gem_make.out

Same thing happens with 1.8.7-p334

Is there a way to fake user-agent?

I'm developing a front-end for a webkit-based TV and I would like to use capybara-webkit. However the views are only rendered if the user agent matches.

Encoding problem under 1.9.2

An existing spec already fails when running under 1.9.2:

  1. Capybara::Session simple app can read utf8 string
    Failure/Error: utf8str.should eq('UTF8文字列')
   expected "UTF8文字列"
        got "UTF8\xE6\x96\x87\xE5\xAD\x97\xE5\x88\x97"

   (compared using ==)
 # ./spec/integration/session_spec.rb:75:in `block (3 levels) in <top (required)>'

save_and_open_page fails

Could it be specific to our page? Seems odd... works in every other driver.

   Then show me the page                   # features/step_definitions/web_steps.rb:209
      "\xA9" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
      /Users/aaronjensen/.rvm/gems/ruby-1.9.2-p180@project/bundler/gems/capybara-97af9bd1c66f/lib/capybara/util/save_and_open_page.rb:13:in `write'
      /Users/aaronjensen/.rvm/gems/ruby-1.9.2-p180@project/bundler/gems/capybara-97af9bd1c66f/lib/capybara/util/save_and_open_page.rb:13:in `save_page'
      /Users/aaronjensen/.rvm/gems/ruby-1.9.2-p180@project/bundler/gems/capybara-97af9bd1c66f/lib/capybara/util/save_and_open_page.rb:19:in `save_and_open_page'
      /Users/aaronjensen/.rvm/gems/ruby-1.9.2-p180@project/bundler/gems/capybara-97af9bd1c66f/lib/capybara/session.rb:281:in `save_and_open_page'
      /Users/aaronjensen/.rvm/gems/ruby-1.9.2-p180@project/bundler/gems/capybara-97af9bd1c66f/lib/capybara/dsl.rb:134:in `save_and_open_page'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.