-
-
function will add a header to the passed in 'PhantomJs.Webpage.Page'
object or overwrite an existing header with the passed in value
Parameters:
Name |
Type |
Description |
page |
PhantomJs.Webpage.Page
|
the Page object to set headers
on |
name |
string
|
the name of the header such as "Accept-Language" |
value |
string
|
the value of the header such as "en-US" |
- Source:
-
-
function will add headers to the passed in 'PhantomJs.Webpage.Page'
object or overwrite them if they already exist
Parameters:
Name |
Type |
Description |
page |
PhantomJs.Webpage.Page
|
the Page object to set headers
on |
headers |
Object[]
|
an array of Objects containing a name and
value |
headers[].name |
string
|
the header key such as "Accept-Language" |
headers[].value |
string
|
= the header value such as "en-US" |
- Source:
-
<static> convertMsToHumanReadable(milliseconds) → {string}
-
function will convert a passed in millisecond value to a more
human-readable output format of HHH hours MM minutes SS seconds
mmm milliseconds
Parameters:
Name |
Type |
Description |
milliseconds |
Integer
|
the milliseconds to be converted |
- Source:
Returns:
a human-readable string representing the passed
in value
-
Type
-
string
-
<static> createPage(viewport, headers) → {PhantomJs.Webpage.Page}
-
function will create a new page in PhantomJs with the passed in
viewport dimensions or a default of 1024x800 and using the passed
in headers. If called within a PFT.tester.test the returned page
will also be set as the PFT.tester.current.page object
Parameters:
Name |
Type |
Argument |
Default |
Description |
viewport |
Object
|
<optional>
|
{width:1024,height:800}
|
an object containing the 'width' and
'height' properties to use with the new page. Ex: { width: 1024,
height: 768 } |
headers |
Object[]
|
<optional>
|
|
an array of objects containing a 'name'
and 'value' property which will be set as headers for all requests
using the returned page. Ex: [{ name: "Accept-Language", value:
"en-US" }] |
headers[].name |
string
|
|
|
the header key such as "Accept-Language" |
headers[].value |
string
|
|
|
= the header value such as "en-US" |
- Source:
Returns:
a new page object
-
Type
-
PhantomJs.Webpage.Page
-
<static> debug()
-
- Source:
-
<static> error()
-
convenience method for
PFT.logger.log with a value of
PFT.logger.ERROR passed as the first parameter and a
boolean value of 'true' passed as the last parameter
- Source:
-
<static> getCookieValue(cookieName) → {string}
-
function will return the value of the specified Cookie if it exists
Parameters:
Name |
Type |
Description |
cookieName |
string
|
the name of the Cookie to be retrieved |
- Source:
Returns:
the value of the specified Cookie or undefined if
not found
-
Type
-
string
-
<static> guid() → {string}
-
function will generate a GUID or UUID complete with dashes
between the sections
- Source:
Returns:
a guid in the form of XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
-
Type
-
string
-
<static> info()
-
- Source:
-
<static> onPageConsoleMessage()
-
function hook allowing for "listening" to any console messages sent
by the 'PhantomJs.Webpage.Page' objects
- Source:
-
<static> renderPage(page, name)
-
function will create a JPG with a quality of 50% using either
the passed in name or the passed in 'PhantomJs.Webpage.Page'
url if no name is passed. The image will be written to the
PFT.IMAGES_DIR directory with the name formatted to remove
spaces and illegal characters
Parameters:
Name |
Type |
Argument |
Default |
Description |
page |
PhantomJs.Webpage.Page
|
|
|
the Page object to be rendered |
name |
string
|
<optional>
|
page.url
|
a name to be used for the image |
- Source:
-
<static> resizeViewport(page, dimensions)
-
function will resize the passed in PhantomJs.Webpage.Page to
the specified dimensions
Parameters:
Name |
Type |
Description |
page |
PhantomJs.Webpage.Page
|
the Page object to resize |
dimensions |
Object
|
an Object containing a width and
height property set to values greater than 0 |
- Source:
-
<static> trace()
-
- Source:
-
<static> warn()
-
- Source: