Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 87 lines (60 sloc) 2.438 kb
d08ff54 @assaf Added new page covering the browser API.
authored
1 zombie.js-troubleshoot(7) -- Troubleshooting guide
92ab434 @assaf Added documentation page for CSS selectors.
authored
2 ==================================================
8f851ca @assaf Added troublehsooting guide.
authored
3
4
5 ## The Dump
6
7 Get the browser to dump its current state. You'll be able to see the
8 current document URL, history, cookies, local/session storage, and
9 portion of the current page:
10
11 browser.dump()
12
13 URL: http://localhost:3003/here/#there
14
15 History:
16 1. http://localhost:3003/here
17 2: http://localhost:3003/here/#there
18
19 Cookies:
20 session=e62ab205; domain=localhost; path=/here
21
22 Storage:
23 localhost:3003 session:
24 day = Monday
25
26 Document:
27 <html>
28 <head>
29 <script src="/jquery.js"></script>
30 <script src="/sammy.js"></script>
31 <script src="/app.js"></script>
32 </head>
33 <body>
34 ...
35
88d2364 @assaf Browser now has a property called `debug` that you can set to
authored
36 The actual report will have much more information.
37
8f851ca @assaf Added troublehsooting guide.
authored
38
39 ## Debugging
40
41 When running in debug mode, Zombie.js will spit out messages to the
42 console. These could help you see what's going on as your tests
43 execute, especially useful around stuff that happens in the background,
44 like XHR requests.
45
88d2364 @assaf Browser now has a property called `debug` that you can set to
authored
46 To turn debugging on/off set `browser.debug` to true/false. You can
47 also set this option when creating a new `Browser` object (the
48 constructor takes an options argument), or for the duration of a single
49 call to `visit` (the second argument being the options).
8f851ca @assaf Added troublehsooting guide.
authored
50
51 For example:
52
39f70ed @assaf `Zombie` and `Browser` are no longer distinct namespaces. What you
authored
53 Browser.visit("http://thedead", { debug: true}, function(err, browser) {
8ef62cc @assaf Updated document with browser.errors and browser.resources
authored
54 console.log(browser.errors);
88d2364 @assaf Browser now has a property called `debug` that you can set to
authored
55 ...
8f851ca @assaf Added troublehsooting guide.
authored
56 });
57
88d2364 @assaf Browser now has a property called `debug` that you can set to
authored
58
8f851ca @assaf Added troublehsooting guide.
authored
59 If you're working on the code and you want to add more debug statements,
88d2364 @assaf Browser now has a property called `debug` that you can set to
authored
60 call `browser.log` with any sequence of arguments (same as
8f851ca @assaf Added troublehsooting guide.
authored
61 `console.log`), or with a function. In the later case, it will call the
62 function only when debugging is turned on, and spit the value returned
63 from the console.
64
65 For example:
66
88d2364 @assaf Browser now has a property called `debug` that you can set to
authored
67 browser.log("Currently visiting", browser.location);
68 browser.log(function() {
8f851ca @assaf Added troublehsooting guide.
authored
69 return "Currently visiting " + browser.location;
70 });
71
72
73 ## Request/response
74
25ec4e2 @assaf Added window.resources to return all resources loaded by the page
authored
75 Each window keeps a trail of every resource request it makes (to load
76 the page itself, scripts, XHR requests, etc). You can inspect these by
77 obtaining the `window.resources` array and looking into it.
8f851ca @assaf Added troublehsooting guide.
authored
78
25ec4e2 @assaf Added window.resources to return all resources loaded by the page
authored
79 For example:
80
8ef62cc @assaf Updated document with browser.errors and browser.resources
authored
81 browser.resources.dump()
8f851ca @assaf Added troublehsooting guide.
authored
82
25ec4e2 @assaf Added window.resources to return all resources loaded by the page
authored
83 The browser object provides the convenient methods `lastRequest`,
84 `lastResponse` and `lastError` that return, respectively, the request,
85 response and error associated with the last resources loaded by the
86 current window.
Something went wrong with that request. Please try again.