Class Browser
- Defined in: Browser.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Browser(timeout)
|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
|
check(selector)
Checks the specified checkbox.
|
|
|
clientDispatch(hostname, request)
Dispatches the given request to the HTTP client.
|
|
|
dispatch(hostname, request)
Returns a promise for a response to the given request.
|
|
|
fill(selector, value)
Fills in the specified input field with the given value.
|
|
|
followLink(selector)
Clicks the link identified by the given selector.
|
|
|
get(url, redirect)
Returns a promise for a JSDOM window with JQuery installed.
|
|
|
getElement(name)
Returns the form element having the given name or matching the specified CSS
selector, or null if not found.
|
|
|
loadDocument(html, mediaType)
Loads the given HTML document into the browser window.
|
|
|
post(url, body, contentType)
Posts the given body data to the given URL.
|
|
|
postForm(url, form)
Posts the given form.
|
|
|
pressButton(selector)
Clicks the specified button.
|
|
|
Returns true if the last page fetch was due to a redirect.
|
|
|
reload()
Reloads the page.
|
|
|
uncheck(selector)
Unchecks the specified checkbox.
|
Class Detail
Browser(timeout)
- Parameters:
- timeout
- the request timeout, in seconds
Method Detail
-
check(selector)Checks the specified checkbox.
- Parameters:
- selector
-
clientDispatch(hostname, request)Dispatches the given request to the HTTP client.
- Parameters:
- hostname
- request
- Returns:
- promise for a clientresponse
-
disableRedirects()
-
dispatch(hostname, request)Returns a promise for a response to the given request.
- Parameters:
- hostname
- request
- Returns:
- promise
-
enableRedirects()
-
fill(selector, value)Fills in the specified input field with the given value.
- Parameters:
- selector
- name or CSS selector
- value
-
followLink(selector)Clicks the link identified by the given selector.
- Parameters:
- selector
- Returns:
- promise
-
get(url, redirect)Returns a promise for a JSDOM window with JQuery installed.
- Parameters:
- url
- redirect
- an optional redirecting response object
- Returns:
- promise
-
getElement(name)Returns the form element having the given name or matching the specified CSS selector, or null if not found.
- Parameters:
- name
- an element name or CSS selector
-
loadDocument(html, mediaType)Loads the given HTML document into the browser window.
- Parameters:
- html
- mediaType
- Returns:
- promise completion promise
-
post(url, body, contentType)Posts the given body data to the given URL.
- Parameters:
- url
- body
- the data to send as the body
- contentType
- the value of the content-type header
-
postForm(url, form)Posts the given form.
- Parameters:
- url
- form
-
pressButton(selector)Clicks the specified button.
- Parameters:
- selector
-
redirected()Returns true if the last page fetch was due to a redirect.
- Returns:
- boolean
-
reload()Reloads the page.
- Returns:
- promise
-
uncheck(selector)Unchecks the specified checkbox.
- Parameters:
- selector