Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Blacklisting: wildcard support #429

wants to merge 155 commits into from

No description provided.

youpy and others added some commits
@youpy youpy Blacklisting can use wildcard patterns 6480be4
@mhoran mhoran Test to verify fix for #399 8e80fe6
@mhoran mhoran Return proper status code from slow iframe app 1cc1428
@seangeo seangeo Fix memory leak of response.
Turns Response into a QObject and sets parent to the
command that emits it.

Each Command is also a child of the decorator commands,
Timeout and PageLoading commnds, so that deleting the
top level command will delete all the children.

See discussion in #430.
@seangeo seangeo Fix authentication time outs.
If the incorrect credentials are provided QNetworkAccessManager just keeps
firing the same signal and it gets stuck in a infinite loop. This change only
sets the user name and password if they are different to the current user
name and password, causing the event to not be continuously triggered after
failed authentications.
@mhoran mhoran Don't start queued commands more than once
TimeoutCommand may receive pageFinished multiple times before
PageLoadingCommand has finished.

Excellent work! I've been seeing similar strange things with commands being started multiple times but wasn't able to track down the error, thought it was due to some left over state in our long running webkit_server processes. Great job!

sikachu and others added some commits
@sikachu sikachu Wrap Ruby code in inline code block 5dab9f7
@mhoran mhoran Ignore custom fonts applied to pseudo elements
WebPage::setUserStylesheet prevents Web Fonts from loading when styles
are applied directly to elements, however if the styles are applied to
pseudo elements, the override does not apply. This leads to crashes on
Mac OS X, likely due to
@mhoran mhoran Serialize window handles using JsonSerializer 17158b7
@mhoran mhoran Extract JSON serializer c0e896b
@mhoran mhoran Serialize console messsages using JsonSerializer ec257f7
@mhoran mhoran Escape control characters in JSON strings 9596c5d
@mhoran mhoran Infinity returns null when serialized
From RFC4627:

  Numeric values that cannot be represented as sequences of digits (such
  as Infinity and NaN) are not permitted.

NaN is invalid, so we already return null.
@mhoran mhoran Support multi-line confirmation messages eabe88e
@mhoran mhoran Support multi-line alert messages 2f9d76b
@mhoran mhoran Support multi-line prompt messages 8a8d12a
@mhoran mhoran JsonSerializer returns QByteArray
JSON supports UTF-16, however the serializer is 8-bit clean.  Instead of
returning a QString only to turn it back into a QByteArray, return a
QByteArray on serialization.
@mhoran mhoran Bump Capybara dependency to 2.0.2
Required for Capybara::SpecHelper.configure.
@mhoran mhoran Replace Capybara::TimeoutError with Timeout::Error
Capybara::TimeoutError has been removed.
@mhoran mhoran Bump to 0.14.0 6b13f51
Adarsh Pandit Update copyright year to 2013 9a8279a
@seangeo seangeo Rescue from Errno::ESRCH in the exit hook in case webkit_server has a…
…lready ended.
@mhoran mhoran Remove font override for first-letter and first-line 495e291
@mhoran mhoran Restore viewport dimensions after rendering screenshots
Fixes #388.
@mhoran mhoran Bump to 0.14.1 667a345
@jferris jferris Include QtNetwork before using it
* Fixes compile errors on arch Linux
@jferris jferris Bump to 0.14.2
* Bugfix release for arch linux compile issues

Does this still work against v0.14.2?


Killer. Going to give this a try this week in our app.


Any chance this might get merged?


Is this going to be merged?

((17 lines not shown))
- if (blacklisted == url) {
- return true;
- } else if (blacklisted.path().isEmpty() && blacklisted.isParentOf(url)) {
- return true;
+ if(blacklisted.indexOf("*") != -1) {
@mhoran Collaborator
mhoran added a note

This if/else clause can be removed if all blacklist entries are treated as wildcard patterns and QString::contains is used to find a match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

I left some line comments in case the original author cares to address them. Either way I'll merge this for the next release.

@youpy, please let me know if you care to address the above issue. It'd also be great if you could add documentation to the README for this feature.

mhoran and others added some commits
@mhoran mhoran Require Ruby 1.9 or higher 2757305
@mhoran mhoran Back the logger with a QFile
Previously all messages were written to a string which grew unbounded
when logging was disabled.
@georgebrock georgebrock Add Vagrant configuration.
capybara-webkit has various development dependencies which can be a little
cumbersome to manage. With vagrant they can all be nicely bundled up in a VM and
installed automatically.
@betelgeuse betelgeuse Fix typo: change Postion to Position ae7b255
@betelgeuse betelgeuse Make Node#text work for svg elements
svg elements don't return to the non standard innerText attribute so
fall back on the standard textContent when innerText is null.

Fixes #437.
@mhoran mhoran Forward stderr from server to stderr, drop stdout
We don't actually write anything to stdout. Also rename the stdout
option to stderr, since that's where we forward the output.
@mhoran mhoran Don't forward stderr to nil
Fixes #455.
@mhoran mhoran Deprecate the stdout option for Connection b023503
@mhoran mhoran Click elements with native events c3a5c29
@mhoran mhoran Raise error when elements are unclickable fad2679
@jferris jferris Add Driver#version to print version info
* Prints version of major components
* Includes capybara, capybara-webkit, Qt, WebKit, QtWebKit
* Useful for debugging available features
@mhoran mhoran Raise error when iframe elements are unclickable c7c6ef5
@mhoran mhoran Capybara should retry when ClickFailed is raised 03d9a5a
@mhoran mhoran JavaScript error handling 6497404
@mhoran mhoran Raise Capybara.ClickFailed on click test failure
Prevents Node#set from succeeding when click test fails.
@mhoran mhoran Serialize errors as JSON b0a5e0a
@mhoran mhoran Return element and position for ClickFailed error 1312a16
@mhoran mhoran Extract error initialization to JsonError module a563448
@mhoran mhoran Rename Command::emitFinished to finish 0af8b2a
@mhoran mhoran Update NEWS for HEAD 1d3092d
@jferris jferris Fix test failures from warnings
* Some machines print warnings to stderr from plugins
* We can't silence these warnings and the tests fail
* Tests now look for a specific string instead of any output
@mhoran mhoran Capybara spec_helper is in capybara/spec 307b5d9
@mhoran mhoran Frame focus via Capybara::Element
Fixes #465.
@mhoran mhoran Implement Node#all_text
The #text method in Capybara 2.1 differentiates between visible and
invisible text. This requires that Node implement #all_text.

To maintain backwards compatibility with Capybara 2.0, Node#text has
been aliased to #visible_text.
@mhoran mhoran Implement Browser#title 4a4b862
@mhoran mhoran Don't ignore hidden elements for click test spec 59817a6
@mhoran mhoran Use JSON.load to instantiate errors
As of JSON 1.7.7, JSON.parse no longer instantiates json_class as
specified in the source document. JSON.load retains the original
@mhoran mhoran Build against Ruby 2.0.0 0b6a5fb
David Tengdin and Matthew Horan Bump Sinatra to silence security warnings 7807831
@mhoran mhoran Remove lingering references to Node#text ed59c54
David Tengdin and Matthew Horan Implement Driver#find_css and Node#find_css ba0353c
David Tengdin and Matthew Horan Remove duplication from Javascript error handling 4d5befd
David Tengdin and Matthew Horan Update appraisals for capybara 2.1 6b687be
David Tengdin and Matthew Horan Add selenium-webdriver as development dependency
Capybara 2.1 will make selenium-webdriver optional.
@mikz mikz added support for double and right click cd815d4
David Tengdin and Matthew Horan Rename Find command to FindXpath c07c71b
David Tengdin and Matthew Horan Remove return from JavascriptCommand finish 6ca5228
David Tengdin and Matthew Horan Implement Node#hover 823c2e7
@vfrride vfrride Use secure RubyGems URL adc6c2e
@mikz mikz fix right click spec and implementation 5e28a0c
@mhoran mhoran QtWebKit renamed to QtWebKitWidgets e06ed60
@mhoran mhoran Replace QtGui with QApplication 6f4f60b
@mhoran mhoran Click the center of the first non-empty rectangle
Fixes #481.
@parndt parndt Updated with syntax highlighting aa6d777
@mhoran mhoran Replace QString::toAscii with QString::toLatin1
QString::toAscii removed in Qt 5.
@mhoran mhoran Install Qt 5 packages on Travis 6dfba83
@mhoran mhoran Reset environment variables in Builder spec f06212e
@mhoran mhoran Precompile headers 9d8373c
@mhoran mhoran Driver#html returns raw data for non-HTML content
The behavior of QWebFrame::toPlainText is undefined if the content
contains non-Latin1 characters. In Qt 5, additional MIME types are
considered supported, so there's no way to get at the raw data when
unsupported content has been loaded. Instead, proxy network replies
through NetworkReplyProxy which provides repetitive reads.
@mhoran mhoran JavaScript line numbers off by one in Qt 5 4b09893
@mhoran mhoran Share the NetworkAccessManager across WebPages
Destroying the NetworkAccessManager seems to result in "terminate called
without an active exception" segfaults. The documentation states that an
application requires only a single single NetworkAccessManager.
@mhoran mhoran Set text fields using native keypress events fec3480
@mhoran mhoran Don't clear readonly text fields when set cdb82eb
@mhoran mhoran Bump Capybara 2.1 appraisal to beta1 896efba
@calebthompson calebthompson Use new codeclimate badges d3f8958
@mhoran mhoran Enabled options in disabled selects are disabled
This is the behavior of Selenium and has been standardized in Capybara.
@mhoran mhoran Don't cast raw frame content to QString
The conversion is lossy and drops non-ASCII characters.

Fixes #503.
@mhoran mhoran Bump Capybara 2.1 dependency to rc1 63a7cc5
@mhoran mhoran Don't look for attached nodes at invalid indices f308d2d
@sikachu sikachu Test Capybara Webkit against Capybara v2.1.0 4b5843f
@levicole levicole Clear localStorage on reset! 047be27
@andreychernih andreychernih Instantiate errors in capybara-webkit 95a119f
@mhoran mhoran Release capybara-webkit 1.0.0
Fixes #505.
Matthew Horan Travis requires qt4-default to build f8b041a
@jferris jferris Include the overlapping xpath for ClickeFailed from obscured elements
This makes it easier to debug failed clicks because of modals, etc.

Example message:

    Failed to click element /html/body/div[@id='one'] because of overlapping
    element /html/body/div[@id='two'] at position 199, 199
@jferris jferris Improve failure message when trying to click invisible elements
When not ignoring invisible elements, the message didn't explain that
the click failed because the element was invisible.
@pivotal-cloudplanner pivotal-cloudplanner Only require 'webrick/cookie' in order to avoid long load times on ru…
…by 2.0.0-p195
@mhoran mhoran Bump selenium-webdriver
Closes #500
@mhoran mhoran Don't bundle with deployment on Travis
Deployment mode breaks appraisals
@JonRowe JonRowe upgrade rspec da29011
@JonRowe JonRowe remove warnings about un-initialised variables bdb8f00
@JonRowe JonRowe switch from == to eq to remove warnings 516c55f
@JonRowe JonRowe remove warnings about variable shadowing e3c4370
@JonRowe JonRowe remove warning about ambiguous arguments 6410ae2
@JonRowe JonRowe using stub to create test doubles is deprecated, use double directly 023295d
@JonRowe JonRowe specifying an error not to raise is deprecated 9d378b4
@JonRowe JonRowe stub! is deprecated and will be removed, use stub 630813a
@JonRowe JonRowe fix spec that was wrongly passing before 4be8355
@znz znz fix typos 5d6ae88
@mhoran mhoran Add license to gemspec
Fixes #567.
Joe Ferris and Matt Horan Add integration coverage for styled file inputs
Uses example from Quirksmode:
@jferris jferris Silence debug messages from Qt
* 99% of the messages we see are useless
* Debug output is driving OS X users nuts
Joe Ferris and Matt Horan Save a screenshot when raising a ClickFailed exception
* Prints the path to the file
* Make it easier to debug what was actually clicked
Joe Ferris and Matt Horan Render a mouse pointer when saving screenshots
* Helpful for ClickFailed errors
@jferris jferris Expect Rubinius to pass
* Build has been passing; let's keep it that way.
@jferris jferris Rewrite qInstallMsgHandler test in C++
* Allows tests independent of debug settings for Qt
* Allows testing behavior unreachable from Ruby
@jferris jferris Fix OS X keychain bug in Qt 5
* Performing basic auth would pop up a keychain dialog
* Pressing "Accept" resulted in an infinite loop
@jferris jferris Simplify Rakefile build
* gem install doesn't depend on rake
* Always build tests during rake
@jferris jferris Fail immediately when trying to compile with less than Qt 4.8
* We use features not present in Qt 4.7
* This fails earlier with a clearer message
@Locke23rus Locke23rus Attempt to visit URLs with invalid characters
* Fixes issues with URLs which include square brackets
@austenito austenito Fix broken QT Webkit link 1e345f8
@eagletmt eagletmt Check node index atomically to prevent race condition
Fixes Capybara::Webkit::InvalidResponseError when nodes are missing.
@jferris jferris Bump to 1.1.0 and update NEWS with changes ded449c
@jferris jferris Remove references to closed mailing list af50f51
@tricknotes tricknotes Fix example code in
The console methods `console_messages` and `error_messages` each return
an array of messages.
@pcreux pcreux Fix typo in README
"documention" => "documentation"
@KapJI KapJI Fix build failures from naming conflict
* Previously attempted to create multiple files named `webkit_server
* Now builds everything in a build/ folder

Fixes #578.
@mhoran mhoran Ignore .ruby-version and .ruby-gemset 7488c0e
@mhoran mhoran Lock capybara dependency to < 2.2
* Though capybara-webkit 1.1 works with capybara 2.2, it does not
  implement all new features.
@mhoran mhoran Include stdio.h in IgnoreDebugOutput
* Hopefully this fixes Travis issues.
@mhoran mhoran Remove Rubinius from travis.yml
* Travis hasn't been able to build rbx in ages.
@mhoran mhoran Release capybara-webkit 1.1.1
* Merry Christmas!
@mperham mperham Make stdout deprecation warning more specific
In a Rails application with a large number of dependencies, it's hard to
know which library is emitting a warning. This adds "capybara-webkit" to
the deprecation warning.

Resolves #607.
@rupurt rupurt Fix killing webkit_server on JRuby
Connection now waits until webkit_server has started to
discover the pid.
@rupurt rupurt Fix build on Travis
Use require_relative for capybara_webkit_builder as RVM
on travis doesn't include lib directory in require paths
@mhoran mhoran Skip forking spec on JRuby
* JRuby doesn't support `fork`, so this test is irrelevant.
@mhoran mhoran Read the expected number of bytes from StringIO
* Instead of sleep, use blocking #read to determine if the expected
  message is logged.
* Fixes failure 2 from #615.
@mhoran mhoran Use a pipe to test command logging
* JRuby doesn't write to StringIO in the same way as cruby/rbx, and the
  #read method used in connection_spec didn't work here.
* Fixes failure 3 from #615.
@mhoran mhoran Build against JRuby (1.9 mode) 98b3f95
@mhoran mhoran Use a pipe to test stderr forwarding
* Assertion was accidentally removed when testing #read as an
@eagletmt eagletmt Better failure when screenshot doesn't save
* Non-writable paths would raise JSON::ParseError
* Now a clearer error is raised
@Numerico Numerico Correct link for reporting crashes
* Link previously referenced Stack Overflow.
* We have a page for this in the wiki.
* Updates the link to reference the wiki.
Alex Kwiatkowski This fixes a stderr redirection test on fast machines. The write pipe…
… was

getting closed before the redirection thread had a chance to copy it's
contents into it.
@mhoran mhoran Qt 5 moved to ubuntu-sdk-team PPA
* Fixes build issues on Travis
@mhoran mhoran Ignore .idea directory 74397d2
@mhoran mhoran Bump selenium-webdriver dependency 360a2ab
@mhoran mhoran Fix Connection stderr redirect spec under Qt 5.3
* qDebug behavior has changed in Qt 5.3:
@jferris jferris Update for Capybara 2.3.0
This adds support for the full Capybara 2.3.0 API. There are two known

* Selenium supports outerWidth and outerHeight, which we cannot, because we
  dont' have an actual OS window.
* Selenium raises errors after interacting with a closed window. We focus the
  next available window after closing.

This commit adds the following:

* Implement Driver#close_window
* Implement Driver#current_window_handle
* Implement Driver#maximize_window
* Implement Driver#open_new_window
* Implement Driver#no_such_window_error
* Implement Driver#resize_window_to
* Implement Driver#switch_to_window
* Implement Driver#window_size
* Implement Driver#go_back
* Implement Driver#go_forward
* Support change events when clearing a text input
* Support setting contentEditable elements
* Support window.close() in JavaScript
* Don't return text from hidden elements
* Skip Capybara specs which use outerWidth, outerHeight
* Don't use Qt object ownership to manage windows
@jferris jferris Use deleteLater to avoid possible null pointer crashes 60ca655
@jferris jferris Make sure to include QDesktopWidget 87baa39
@jferris jferris Update Appraisals f689828
@mhoran mhoran Simplify shutdown logic for Connection
* Use a QSocketNotifier listening to stdin to determine when the parent
  process has detached.
@mhoran mhoran Update Travis builds
* Test Capybara 2.2 and 2.3 compatibility on all platforms.
* Drop support for Capybara 2.0.
* Only test Qt 5 on 1.9.3. The C implementation is the same for all Ruby
  versions, so there's no need to test against all platforms.
@mhoran mhoran Release capybara-webkit 2.1.0
* Capybara 2.3 compatibility.
* Kill webkit_server when parent process closes stdin.
@mhoran mhoran Raise better errors if server fails to start
* When WEBKIT_SERVER_START_TIMEOUT was reached, @port would get set to
  nil. If execution of the SERVER_PROCESS returned immediately, @port
  would get set to 0. This lead to odd cross-platform behavior in
  #connect, which would try to connect to a nonsense port.
@mhoran mhoran Install bundler Gem tasks in bundler namespace
* The release task in Bundler >= 1.3.1 depends on the build task, which
  conflicts with our build task, resulting in a webkit_server build
  instead of a gem build.

[ci skip]
@youpy youpy Simplify blacklist matching cae061f


Please let me close this pull request for now.

@youpy youpy closed this

@youpy Are you going to update this?


We're about to release capybara-webkit 1.3, so I've merged this in myself. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.