Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 245 lines (182 sloc) 6.904 kB
5965f8a @jasonm Added README with a link to download Qt on OSX
jasonm authored
1 capybara-webkit
2 ===============
3
c155b37 @mhoran Travis CI integration
mhoran authored
4 [![Build Status](https://secure.travis-ci.org/thoughtbot/capybara-webkit.png?branch=master)](https://travis-ci.org/thoughtbot/capybara-webkit) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/thoughtbot/capybara-webkit)
a432440 @gabebw Add Code Climate badge
gabebw authored
5
59c4eae @jferris Updated license ane readme
jferris authored
6 A [capybara](https://github.com/jnicklas/capybara) driver that uses [WebKit](http://webkit.org) via [QtWebKit](http://doc.qt.nokia.com/4.7/qtwebkit.html).
5965f8a @jasonm Added README with a link to download Qt on OSX
jasonm authored
7
6b724ef @jferris Update README instructions about compiler issues
jferris authored
8 Qt Dependency and Installation Issues
213229d @jferris Update README to indicate required version of Qt
jferris authored
9 -------------------------------------
5965f8a @jasonm Added README with a link to download Qt on OSX
jasonm authored
10
578e5c7 @gabebw Spruce up the README
gabebw authored
11 capybara-webkit depends on a WebKit implementation from Qt, a cross-platform
12 development toolkit. You'll need to download the Qt libraries to build and
c5e6396 @jferris Moved info about installing QT into the Wiki
jferris authored
13 install the gem. You can find instructions for downloading and installing QT on
213229d @jferris Update README to indicate required version of Qt
jferris authored
14 the
15 [capybara-webkit wiki](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
5e25b0a @mhoran Update Qt requirement
mhoran authored
16 capybara-webkit requires Qt version 4.8.
657ee68 @jferris Clarify installation notes
jferris authored
17
4b044cc @halogenandtoast Added README info about Windows support.
halogenandtoast authored
18 Windows Support
19 ---------------
20
213229d @jferris Update README to indicate required version of Qt
jferris authored
21 Currently 32-bit Windows will compile capybara-webkit. Support for Windows is provided by the open source community and Windows related issues should be posted to the [mailing list](http://groups.google.com/group/capybara-webkit)
4b044cc @halogenandtoast Added README info about Windows support.
halogenandtoast authored
22
d3f344a @jferris Added a note about crashes to the README
jferris authored
23 Reporting Issues
24 ----------------
25
26 Without access to your application code we can't easily debug most crashes or
f82d661 Fix typo
Lake Denman authored
27 generic failures, so we've included a debug version of the driver that prints a
d3f344a @jferris Added a note about crashes to the README
jferris authored
28 log of what happened during each test. Before filing a crash bug, please see
29 [Reporting Crashes](https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes).
30 You're much more likely to get a fix if you follow those instructions.
31
6b724ef @jferris Update README instructions about compiler issues
jferris authored
32 If you are having compiling issues please check out the
a4fcb8e @jferris Fixed Installing QT link
jferris authored
33 [capybara-webkit wiki](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
6b724ef @jferris Update README instructions about compiler issues
jferris authored
34 If you don't have any luck there, please post to the
35 [mailing list](http://groups.google.com/group/capybara-webkit). Please don't
36 open a Github issue for a system-specific compiler issue.
d8c640d @halogenandtoast Added note about mailing list for compilation errors.
halogenandtoast authored
37
d7f491d @croaky improving the install instructions
croaky authored
38 CI
39 --
40
41 If you're like us, you'll be using capybara-webkit on CI.
657ee68 @jferris Clarify installation notes
jferris authored
42
87a00ab @jferris Added more readme notes on Qt and Xvfb
jferris authored
43 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, or try out the [headless gem](https://github.com/leonid-shevtsov/headless).
f754e93 @jferris Added Ubunutu instructions to the README
jferris authored
44
59c4eae @jferris Updated license ane readme
jferris authored
45 Usage
46 -----
47
48 Add the capybara-webkit gem to your Gemfile:
49
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
50 ```ruby
51 gem "capybara-webkit"
52 ```
59c4eae @jferris Updated license ane readme
jferris authored
53
54 Set your Capybara Javascript driver to webkit:
55
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
56 ```ruby
57 Capybara.javascript_driver = :webkit
58 ```
59c4eae @jferris Updated license ane readme
jferris authored
59
7be8f94 @jferris Clean up README
jferris authored
60 In cucumber, tag scenarios with @javascript to run them using a headless WebKit browser.
59c4eae @jferris Updated license ane readme
jferris authored
61
5dab9f7 @sikachu Wrap Ruby code in inline code block
sikachu authored
62 In RSpec, use the `:js => true` flag. See the [capybara documention](http://rubydoc.info/gems/capybara#Using_Capybara_with_RSpec) for more information about using capybara with RSpec.
7be8f94 @jferris Clean up README
jferris authored
63
e2c103c @halogenandtoast Update documentation to point to actual capybara readme.
halogenandtoast authored
64 Take note of the transactional fixtures section of the [capybara README](https://github.com/jnicklas/capybara/blob/master/README.md).
eb6165d @joemsak Add a couple of notes that :js => true should still be used, and to n…
joemsak authored
65
6d224d0 @jc00ke Adding note about Capybara.app with Sinatra
jc00ke authored
66 If you're using capybara-webkit with Sinatra, don't forget to set
67
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
68 ```ruby
69 Capybara.app = MySinatraApp.new
70 ```
6d224d0 @jc00ke Adding note about Capybara.app with Sinatra
jc00ke authored
71
7361822 @jferris Document unofficial driver methods
jferris authored
72 Non-Standard Driver Methods
73 ---------------------------
74
75 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`.
76
77 **console_messages**: returns an array of messages printed using console.log
78
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
79 ```js
80 // In Javascript:
81 console.log("hello")
82 ```
83
84 ```ruby
85 # In Ruby:
86 page.driver.console_messages
87 => {:source=>"http://example.com", :line_number=>1, :message=>"hello"}
88 ```
7361822 @jferris Document unofficial driver methods
jferris authored
89
90 **error_messages**: returns an array of Javascript errors that occurred
91
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
92 ```ruby
93 page.driver.error_messages
94 => {:source=>"http://example.com", :line_number=>1, :message=>"SyntaxError: Parse error"}
95 ```
7361822 @jferris Document unofficial driver methods
jferris authored
96
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
97 **alert_messages, confirm_messages, prompt_messages**: returns arrays of Javascript dialog messages for each dialog type
98
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
99 ```js
100 // In Javascript:
101 alert("HI");
102 confirm("Ok?");
103 prompt("Number?", "42");
104 ```
105
106 ```ruby
107 # In Ruby:
108 page.driver.alert_messages
109 => ["Hi"]
110 page.driver.confirm_messages
111 => ["Ok?"]
112 page.driver.prompt_messages
113 => ["Number?"]
114 ```
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
115
7361822 @jferris Document unofficial driver methods
jferris authored
116 **resize_window**: change the viewport size to the given width and height
117
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
118 ```ruby
119 page.driver.resize_window(500, 300)
120 page.driver.evaluate_script("window.innerWidth")
121 => 500
122 ```
7361822 @jferris Document unofficial driver methods
jferris authored
123
124 **cookies**: allows read-only access of cookies for the current session
125
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
126 ```ruby
127 page.driver.cookies["alpha"]
128 => "abc"
129 ```
7361822 @jferris Document unofficial driver methods
jferris authored
130
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
131 **accept_js_confirms!**: accept any Javascript confirm that is triggered by the page's Javascript
132
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
133 ```js
134 // In Javascript:
135 if (confirm("Ok?"))
136 console.log("Hi");
137 else
138 console.log("Bye");
139 ```
140
141 ```ruby
142 # In Ruby:
143 page.driver.accept_js_confirms!
144 visit "/"
145 page.driver.console_messages.first[:message]
146 => "Hi"
147 ```
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
148
149 **dismiss_js_confirms!**: dismiss any Javascript confirm that is triggered by the page's Javascript
150
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
151 ```js
152 // In Javascript:
153 if (confirm("Ok?"))
154 console.log("Hi");
155 else
156 console.log("Bye");
157 ```
158
159 ```ruby
160 # In Ruby:
161 page.driver.dismiss_js_confirms!
162 visit "/"
163 page.driver.console_messages.first[:message]
164 => "Bye"
165 ```
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
166
167 **accept_js_prompts!**: accept any Javascript prompt that is triggered by the page's Javascript
168
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
169 ```js
170 // In Javascript:
171 var a = prompt("Number?", "0")
172 console.log(a);
173 ```
174
175 ```ruby
176 # In Ruby:
177 page.driver.accept_js_prompts!
178 visit "/"
179 page.driver.console_messages.first[:message]
180 => "0"
181 ```
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
182
183 **dismiss_js_prompts!**: dismiss any Javascript prompt that is triggered by the page's Javascript
184
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
185 ```js
186 // In Javascript:
187 var a = prompt("Number?", "0")
188 if (a != null)
189 console.log(a);
190 else
191 console.log("you said no"));
192 ```
193
194 ```ruby
195 # In Ruby:
196 page.driver.dismiss_js_prompts!
197 visit "/"
198 page.driver.console_messages.first[:message]
199 => "you said no"
200 ```
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
201
202 **js_prompt_input=(value)**: set the text to use if a Javascript prompt is encountered and accepted
203
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
204 ```js
205 // In Javascript:
206 var a = prompt("Number?", "0")
207 console.log(a);
208 ```
209
210 ```ruby
211 # In Ruby:
212 page.driver.js_prompt_input = "42"
213 page.driver.accept_js_prompts!
214 visit "/"
215 page.driver.console_messages.first[:message]
216 => "42"
217 ```
e677cb9 @danivovich Control JavaScript confirmation dialogs from Ruby
danivovich authored
218
f991155 @jferris Document #header method
jferris authored
219 **header**: set the given HTTP header for subsequent requests
220
0faed27 @parndt Updated README.md with syntax highlighting
parndt authored
221 ```ruby
222 page.driver.header 'Referer', 'https://www.thoughtbot.com'
223 ```
f991155 @jferris Document #header method
jferris authored
224
3e9527a @mike-burns a contributing guide
mike-burns authored
225 Contributing
226 ------------
227
228 See the CONTRIBUTING document.
229
59c4eae @jferris Updated license ane readme
jferris authored
230 About
231 -----
232
fc472aa @jferris Update author list
jferris authored
233 The capybara WebKit driver is maintained by Joe Ferris and Matt Horan. It was written by [thoughtbot, inc](http://thoughtbot.com/community) with the help of numerous [contributions from the open source community](https://github.com/thoughtbot/capybara-webkit/contributors).
59c4eae @jferris Updated license ane readme
jferris authored
234
37b3d24 @nicholaides Documenting that some code was borrowed from Phantom.js
nicholaides authored
235 Code for rendering the current webpage to a PNG is borrowed from Phantom.js' implementation.
236
64cf394 @jferris Added a note about X servers and the thoughtbot logo
jferris authored
237 ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
238
59c4eae @jferris Updated license ane readme
jferris authored
239 The names and logos for thoughtbot are trademarks of thoughtbot, inc.
240
241 License
242 -------
243
9a8279a Update copyright year to 2013
Adarsh Pandit authored
244 capybara-webkit is Copyright (c) 2010-2013 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
Something went wrong with that request. Please try again.