API
Classes
It manages the use of environment variables by providing useful methods for checking and obtaining the variables.
Provides Puppeteer initialization by creating Browser and Page instances to provide the browser context necessary for the execution of a custom function.
Functions
Process.([browserOptions]) ⇒ Promise.<object>
Creates the Browser and Page instances.
Exposes the logger function to be used in the browser.
Environment
It manages the use of environment variables by providing useful methods for checking and obtaining the variables.
Kind: global class
static
.is(environment) ⇒
boolean
.has(variable) ⇒
boolean
.get(variable) ⇒
string
|Array
|object
|null
environment.PRODUCTION
Value of the variable defined by the NodeJS processor to identify the Production execution environment.
Kind: instance property of Environment
environment.IMPRESSIONIST_VERSION
The current version of the library. It can be used, for example, for bug reporting plugins.
Kind: instance property of Environment
Environment.is(environment) ⇒ boolean
boolean
Check if a specific environment is running. i.e prod or dev.
Kind: static method of Environment
Returns: boolean
- Result true or false.
Example
Environment.has(variable) ⇒ boolean
boolean
Check if a specific environment variable exists.
Kind: static method of Environment
Returns: boolean
- Result true or false.
Example
Environment.get(variable) ⇒ string
| Array
| object
| null
string
| Array
| object
| null
Return a specific env var. If not exist return null.
Kind: static method of Environment
Example
Process
Provides Puppeteer initialization by creating Browser and Page instances to provide the browser context necessary for the execution of a custom function.
Kind: global class Summary: Initialize Puppeteer.
.execute(url, customFunction) ⇒
Promise
.openConnection(url, [browserOptions]) ⇒
Promise.<object>
.createPage(browser) ⇒
Promise.<object>
.setPageConfigurations(page, url) ⇒
Promise.<void>
.connect(browserWSEndpoint, customFunction, [...args]) ⇒
Promise.<any>
Process.execute(url, customFunction) ⇒ Promise
Promise
It provides the necessary context to run a function in the puppeteer or browser context by executing a series of steps, such as initializing a Browser instance and applying extra configurations defined by an input parameter, initializing a Page instance and applying default configurations to it so that the Impressionist library can be used in the browser context of that specific instance.
Kind: static method of Process
Returns: Promise
- Promise object that represents the result of the custom function.
Properties
Example (Basic Usage)
Example (Enabling Browser User Interface)
Process.openConnection(url, [browserOptions]) ⇒ Promise.<object>
Promise.<object>
Open a connection to a browser instance.
Kind: static method of Process
Returns: Promise.<object>
- Promise object that represents an object that stores the browser, page instances.
Process.createPage(browser) ⇒ Promise.<object>
Promise.<object>
Creates a new instance of Page.
Kind: static method of Process
Returns: Promise.<object>
- Promise object that represents a Page instance.
Example (Create a second Page instance)
Process.setPageConfigurations(page, url) ⇒ Promise.<void>
Promise.<void>
Method that takes as a parameter the Page instance that is started internally within the class. The method can modify the behavior of the Page instance. Please read the documentation about the Page instance.
Kind: static method of Process
Returns: Promise.<void>
- Promise object that represents the method execution completion.
Properties
Example (Create a second Page instance and apply default configurations)
Example (Create a second Page instance and set a different viewport)
Process.connect(browserWSEndpoint, customFunction, [...args]) ⇒ Promise.<any>
Promise.<any>
Execute a function in a specific browser endpoint.
Kind: static method of Process
Returns: Promise.<any>
- Promise object that represents the result of the custom function.
Process.([browserOptions]) ⇒ Promise.<object>
Promise.<object>
Creates the Browser and Page instances.
Kind: global function
Returns: Promise.<object>
- Promise object that represents an object that stores the browser, page instances.
Process.(page)
Exposes the logger function to be used in the browser.
Kind: global function
Classes
Log on each of the subscribed monitoring tools.
Initialize Pino and expose its functionality for login.
Provides an interface for Sentry integration with Puppeteerist.
Functions
Perform the necessary steps to configure Sentry.
MonitorManager
Log on each of the subscribed monitoring tools.
Kind: global class
MonitorManager.log(report)
Register a report.
Kind: static method of MonitorManager
MonitorManager.subscribe(logger)
Subscribe to a monitoring or logging tool.
Kind: static method of MonitorManager
MonitorManager.unsubscribe(logger)
Unsubscribe to a monitoring or logging tool.
Kind: static method of MonitorManager
MonitorManager.clear()
Delete all logers. It can be used to discard the default loggers.
Kind: static method of MonitorManager
Pino
Initialize Pino and expose its functionality for login.
Kind: global class
Pino.log(report)
Log a report.
Kind: static method of Pino
Sentry
Provides an interface for Sentry integration with Puppeteerist.
Kind: global class
.sendException(error) ⇒
Promise.<void>
Sentry.log(report)
Log a report.
Kind: static method of Sentry
Sentry.sendException(error) ⇒ Promise.<void>
Promise.<void>
Send error generated to Sentry while Puppeteer execution.
Kind: static method of Sentry
Returns: Promise.<void>
- Promise object that represents end of the Sentry actions.
Sentry.()
Perform the necessary steps to configure Sentry.
Kind: global function Example
Classes
Collect items from a Collection by being iterated through a context element.
It provides a data structure to control the context, which is an object with two properties. The first is document, which refers to the document object present in the browser context. If the context is not running in Browser context then document is set to null. The other property is element, which stores an element that will be used by some instance during the execution of the collectable tree.
Custom error to be used by the QuerySelector class in case an element or series of elements does not exist in the DOM.
Custom error to be used by the Collectable class to identify if the error was created by the error or require methods of the same class.
Custom error to be used by the Collectable class to return any error caused in the execution of the Collectable tree and that does not have a Collectable default method specified.
Log useful information and register errors.
Provides a common method to share across the different strategies managers.
Provides a static method that checks the data type of an incoming value.
Loads all DOM elements that are handled by a LazyLoad.
Handles the pagination of an HTML section.
Functions
Logger.(elements) ⇒ Array.<object>
Extract useful information from elements and give them a specific format inside a list.
Collector
Collect items from a Collection by being iterated through a context element.
Kind: global class
new Collector(contextAccessor, collection)
collector.iterationQuery
Queries to append in iterate method.
Kind: instance property of Collector
collector.call(context) ⇒ Promise.<Array>
Promise.<Array>
Execute the collector.
Kind: instance method of Collector
Returns: Promise.<Array>
- An object that represents a promise for the collected items.
Example
collector.iterate(queries) ⇒ Collector
Collector
Creates a new Collector that have a custom accessor and a collection.
Kind: instance method of Collector
Returns: Collector
- A Collector instance.
Example
Context
It provides a data structure to control the context, which is an object with two properties. The first is document, which refers to the document object present in the browser context. If the context is not running in Browser context then document is set to null. The other property is element, which stores an element that will be used by some instance during the execution of the collectable tree.
Kind: global class Summary: Create an object to give context to instance executions.
.getElement() ⇒
string
|Array
|Object
context.clone() ⇒ Context
Context
Create a new instance of the same class and assign the values of the object from which it was created. The reason for this method is that the values of the element property can be updated or modified without affecting the original context object, since the new instance is a completely independent object from the original one. Something that does not happen with a simple copy of objects.
Kind: instance method of Context
Summary: Clones a context instance.
Returns: Context
- Object that represents the context or the element that is being passed on nested instances executions.
Example (Clone an existing Context instance.)
context.update(element) ⇒ Context
Context
Update the context object by adding a new value for the element property. First, clone the existing Context object using the clone () method and then update the value of element.
Kind: instance method of Context
Summary: Update the Context object.
Returns: Context
- Object that represents the context or the element that is being passed on nested instances executions.
Example (Update an existing Context instance.)
context.getElement() ⇒ string
| Array
| Object
string
| Array
| Object
Gets the value of the element property. If element is equal to null then it will return the value of the document property.
Kind: instance method of Context
Returns: string
| Array
| Object
- an element that will be used by some instance during the execution of the collectable tree.
Example (Getting the node to be used for nested executions)
SelectorError
Custom error to be used by the QuerySelector class in case an element or series of elements does not exist in the DOM.
Kind: global class
new SelectorError(selector)
CustomError
Custom error to be used by the Collectable class to identify if the error was created by the error or require methods of the same class.
Kind: global class
new CustomError(message)
CollectableError
Custom error to be used by the Collectable class to return any error caused in the execution of the Collectable tree and that does not have a Collectable default method specified.
Kind: global class
new CollectableError(message, history)
Logger
Log useful information and register errors.
Kind: global class
Logger.error(origin, message)
Error level.
Kind: static method of Logger
Logger.warn(origin, elements, message)
Warn level.
Kind: static method of Logger
Logger.info(origin, elements, message)
Info level.
Kind: static method of Logger
Logger.debug(origin, elements, message)
Debug level.
Kind: static method of Logger
StrategyManager
Provides a common method to share across the different strategies managers.
Kind: global class
StrategyManager.lookUp(element, strategies) ⇒ Promise.<object>
Promise.<object>
Search or look up the best strategy.
Kind: static method of StrategyManager
Returns: Promise.<object>
- An object that represents a promise for a specific strategy.
TypeValidator
Provides a static method that checks the data type of an incoming value.
Kind: global class
.check(value, [type]) ⇒
Error
|void
TypeValidator.check(value, [type]) ⇒ Error
| void
Error
| void
Check the entry value if its data type of instance is the same than the type argument.
Kind: static method of TypeValidator
Returns: Error
| void
- - Throws an error if the type does not match the value's data type.
Example (Checking if values is String)
Example (Checking if value is Number)
TypeValidator.deepCheck(value, type)
Check recursively if he entry value if its data type of instance is the same than the type argument.
Kind: static method of TypeValidator
LazyLoadHandler
Loads all DOM elements that are handled by a LazyLoad.
Kind: global class
LazyLoadHandler.execute(buttonSelector)
Executes the loading of all the elements by providing a clickable element selector, for example, a Next button.
Kind: static method of LazyLoadHandler
Pagination
Handles the pagination of an HTML section.
Kind: global class
Pagination.execute(buttonSelector, [time])
Create a generator object with the new rendered document.
Kind: static method of Pagination
Logger.(elements) ⇒ Array.<object>
Array.<object>
Extract useful information from elements and give them a specific format inside a list.
Kind: global function
Returns: Array.<object>
- - List of objects that represent an element.
Classes
Execute a set of queries.
Iterates over each item in context created by a collection, returning it to be collected upon.
Default ContextAcessor, used when there is not contextProcessor in Collector.
Shortcut to create a Collector isntances for collecting a collection for each iterable item in the context.
Shortcut to create Collector that returns a NodeList of DOM elements.
Shortcut to create Collector that returns a list of combinations generated by Options intances.
Creates an iterable object from a series of options and at the same time, the iterable object has a function that is executed in each iterative cycle (next method call) to select a specific option value.
Manage the OptionStrategies.
Functions
OptionCollectorFactory.(options) ⇒ object
Execute normalization actions for each of the options. For example, adding default values in queries.
OptionCollectorFactory.(collector, options)
Add queries to the Collector instance to extract each of the options in the Collector run.
Collection
Execute a set of queries.
Kind: global class
.call(context) ⇒
Promise.<object>
new Collection(queries)
collection.call(context) ⇒ Promise.<object>
Promise.<object>
Execute a set of queries.
Kind: instance method of Collection
Returns: Promise.<object>
- An object that represents a promise for a object with the results of the queries.
Example
collection.postProcessor(customProcessor) ⇒ Collection
Collection
Add a new postProcessor to the list.
Kind: instance method of Collection
Returns: Collection
- Returns the current Collection instance.
IterableAccessor
Iterates over each item in context created by a collection, returning it to be collected upon.
Kind: global class
.call(context) ⇒
Promise.<Generator>
new IterableAccessor(collection)
iterableAccessor.call(context) ⇒ Promise.<Generator>
Promise.<Generator>
Create a generator to pass the new context.
Kind: instance method of IterableAccessor
Returns: Promise.<Generator>
- An object that represents a promise for a generator of context objects.
Example (Receives a Collection and returns an iterable of Context objects)
ProxyAccessor
Default ContextAcessor, used when there is not contextProcessor in Collector.
Kind: global class
proxyAccessor.call(context) ⇒ Generator.<Context>
Generator.<Context>
Returns a generator with the incoming context.
Kind: instance method of ProxyAccessor
Returns: Generator.<Context>
- Returns the incoming context as part of a generator.
Example
CollectionCollectorFactory
Shortcut to create a Collector isntances for collecting a collection for each iterable item in the context.
Kind: global class
new CollectionCollectorFactory(collector, queries)
Returns: Collector
- A Collector instance.
ElementCollectorFactory
Shortcut to create Collector that returns a NodeList of DOM elements.
Kind: global class
new ElementCollectorFactory(query)
Returns: Collector
- A new instance of Collector.
OptionCollectorFactory
Shortcut to create Collector that returns a list of combinations generated by Options intances.
Kind: global class
new OptionCollectorFactory(options)
Returns: Collector
- A Collector instance.
Option
Creates an iterable object from a series of options and at the same time, the iterable object has a function that is executed in each iterative cycle (next method call) to select a specific option value.
Kind: global class Summary: Creates an iterable object from options.
new Option(identifier, element, [strategy])
Example (Create an Option instance of a dropwdown (select element).)
Example (Create an Option instace of a group of buttons (div elements).)
option.call()
Creates an iterable object that contains the values of an HTML element and its respective selection function. The values collection and function execution is controlled by the JavaScript Iteration Protocols.
Kind: instance method of Option
Example (Use the next generator method to get the values)
OptionStrategyManager
Manage the OptionStrategies.
Kind: global class
.lookUp(element) ⇒
Promise.<OptionStrategy>
OptionStrategyManager.add(strategy)
Add or register a OptionStrategy sub-class.
Kind: static method of OptionStrategyManager
Example
OptionStrategyManager.lookUp(element) ⇒ Promise.<OptionStrategy>
Promise.<OptionStrategy>
Search or look up the best strategy.
Kind: static method of OptionStrategyManager
Returns: Promise.<OptionStrategy>
- Object that represents a promise to return a sub-class of OptionStrategy.
Example (SelectStrategy matched)
OptionCollectorFactory.(options) ⇒ object
object
Execute normalization actions for each of the options. For example, adding default values in queries.
Kind: global function
Returns: object
- The normalized options.
OptionCollectorFactory.(collector, options)
Add queries to the Collector instance to extract each of the options in the Collector run.
Kind: global function
Classes
Converts collection into a generator of elements.
Processes collected values into options.
Knows how to get and set values from a group of options.
Default strategy.
Knows how to get and set values from SELECT DOM elements.
Knows how to get and set values from an element with two states: TRUE/FALSE.
Creates a query chain from a custom selector.
Manage which interpretation strategy will process the custom selector.
Contains the specific logic to process nested structures. In case no parameter is passed to its constructor then it will return the previous result in the execution of the chain.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Contains specific logic to extract elements from the DOM using a CSS selector.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Returns a default value if there the expected result is not valid.
Provide a directory to store proxy function that will be used to instantiate the Implementation sub-classes. The directory is made up of the name of each proxy function and its sub-class constructor equivalent.
Creates a collector that will return a generator of a list of elements.
Perform actions during initialization.
Iterate a Collector instance against a set of queries.
Contains the specific Selector that allows concatenating other query Selectors.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Creates a collector that will return a generator of a list of option values.
Perform actions after data extraction.
Perform actions before data extraction.
Contains the specific Selector to obtain properties of DOM elements.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Returns an error if the result is not a valid value.
Interprets Select Strings.
Contains the specific Selector to check if a single element is expected as it turns out, otherwise throw an error.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Contains specific logic to extract elements from the DOM using a xpath selector.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Functions
CollectionOptionProcessor.(options) ⇒ Promise.<Generator>
It takes Option instances and calculates all possible values of the combinations of those options.
CollectionElementProcessor
Converts collection into a generator of elements.
Kind: global class
CollectionElementProcessor.call(elementCollection) ⇒ Generator.<(Element|any)>
Generator.<(Element|any)>
Execute the processor.
Kind: static method of CollectionElementProcessor
Returns: Generator.<(Element|any)>
- A generator with DOM elements.
Example (Receives a collection with a list of DOM elements an returns an array with elements)
CollectionOptionProcessor
Processes collected values into options.
Kind: global class
CollectionOptionProcessor.call(elementCollection) ⇒ Promise.<Generator>
Promise.<Generator>
Returns all possible values of the options that were passed to Collection.
Kind: static method of CollectionOptionProcessor
Returns: Promise.<Generator>
- An object that represents a promise object for a generator containing all the possible values processed of each option.
Example (Processing a series of options)
GroupStrategy
Knows how to get and set values from a group of options.
Kind: global class
.getOptions(identifier, element) ⇒
Promise.<Array>
.setOption(element, value) ⇒
Promise.<Boolean>
.match(element) ⇒
Promise.<Boolean>
GroupStrategy.getOptions(identifier, element) ⇒ Promise.<Array>
Promise.<Array>
Extract a value that will be used to identify each option.
Kind: static method of GroupStrategy
Returns: Promise.<Array>
- Object that represents a promise for a list of objects.
Example (Get options from a select element)
GroupStrategy.setOption(element, value) ⇒ Promise.<Boolean>
Promise.<Boolean>
Select a specific option.
Kind: static method of GroupStrategy
Returns: Promise.<Boolean>
- Object that represents a promise for the completion of a select action.
Example (Set second option to a div element)
GroupStrategy.match(element) ⇒ Promise.<Boolean>
Promise.<Boolean>
Check if the particular strategy is suitable for a certain element of the DOM.
Kind: static method of GroupStrategy
Returns: Promise.<Boolean>
- Object that represents a promise for a TRUE or FALSE value.
Example (Match elements)
MissingStrategy
Default strategy.
Kind: global class
SelectStrategy
Knows how to get and set values from SELECT DOM elements.
Kind: global class
.getOptions(identifier, element) ⇒
Promise.<Array>
.setOption(element, value) ⇒
Promise.<void>
.match(element) ⇒
Promise.<(Boolean|Error)>
SelectStrategy.getOptions(identifier, element) ⇒ Promise.<Array>
Promise.<Array>
Extract a value that will be used to identify each option.
Kind: static method of SelectStrategy
Returns: Promise.<Array>
- Object that represents a promise for a list of objects.
Example (Get options from a select element)
SelectStrategy.setOption(element, value) ⇒ Promise.<void>
Promise.<void>
Select a specific option.
Kind: static method of SelectStrategy
Returns: Promise.<void>
- Object that represents a promise for the completion of a select action.
Example (Set second option to a select element)
SelectStrategy.match(element) ⇒ Promise.<(Boolean|Error)>
Promise.<(Boolean|Error)>
Check if the particular strategy is suitable for a certain element of the DOM.
Kind: static method of SelectStrategy
Returns: Promise.<(Boolean|Error)>
- Object that represents a promise for a TRUE or FALSE value.
Example (Match a SELECT element)
ToogleStrategy
Knows how to get and set values from an element with two states: TRUE/FALSE.
Kind: global class
.getOptions(identifier, element) ⇒
Promise.<Array>
.setOption(element, value) ⇒
Promise.<void>
.match(element) ⇒
Promise.<(Boolean|Error)>
ToogleStrategy.getOptions(identifier, element) ⇒ Promise.<Array>
Promise.<Array>
Extract a value that will be used to identify each option.
Kind: static method of ToogleStrategy
Returns: Promise.<Array>
- Object that represents a promise for a list of objects.
Example (Get options from a checkbox element)
ToogleStrategy.setOption(element, value) ⇒ Promise.<void>
Promise.<void>
Select a specific option.
Kind: static method of ToogleStrategy
Returns: Promise.<void>
- Object that represents a promise for the completion of a select action.
Example (Select an input element)
ToogleStrategy.match(element) ⇒ Promise.<(Boolean|Error)>
Promise.<(Boolean|Error)>
Check if the particular strategy is suitable for a certain element of the DOM.
Kind: static method of ToogleStrategy
Returns: Promise.<(Boolean|Error)>
- Object that represents a promise for a TRUE or FALSE value.
Example (Match an element)
SelectorInterpreter
Creates a query chain from a custom selector.
Kind: global class
new SelectorInterpreter(selector)
Returns: Query
- A query instance.
Example
InterpreterStrategyManager
Manage which interpretation strategy will process the custom selector.
Kind: global class
InterpreterStrategyManager.add(strategy)
Add a new strategy.
Kind: static method of InterpreterStrategyManager
Example
InterpreterStrategyManager.lookUp(selector) ⇒ object
object
Search among the available strategies which of them is the most suitable to process a specific selector.
Kind: static method of InterpreterStrategyManager
Returns: object
- A strategy that can process the custom selector.
Example ({h1} gets InterpreterElementStrategy)
All ⇐ Selector
Selector
Contains the specific logic to process nested structures. In case no parameter is passed to its constructor then it will return the previous result in the execution of the chain.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Kind: global class
Summary: Process nested structures.
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
all.alternatives
Queue of alternative definitions.
Kind: instance property of All
all.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of All
Overrides: validateParameters
all.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of All
Overrides: execute
all.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of All
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
all.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of All
Returns: this
- The instance of a Selector sub-class.
all.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of All
all.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of All
Returns: this
- Instance of Selector sub-class.
all.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of All
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Css ⇐ Selector
Selector
Contains specific logic to extract elements from the DOM using a CSS selector.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Kind: global class
Summary: Extracts Dom Elements.
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
css.alternatives
Queue of alternative definitions.
Kind: instance property of Css
css.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Css
Overrides: validateParameters
css.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Css
Overrides: execute
css.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Css
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
css.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Css
Returns: this
- The instance of a Selector sub-class.
css.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Css
css.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Css
Returns: this
- Instance of Selector sub-class.
css.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Css
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Default ⇐ Selector
Selector
Returns a default value if there the expected result is not valid.
Kind: global class
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
default.alternatives
Queue of alternative definitions.
Kind: instance property of Default
default.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Default
default.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Default
Overrides: execute
default.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Default
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
default.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Default
Returns: this
- The instance of a Selector sub-class.
default.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Default
default.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Default
Returns: this
- Instance of Selector sub-class.
default.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Default
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
SelectorDirectory
Provide a directory to store proxy function that will be used to instantiate the Implementation sub-classes. The directory is made up of the name of each proxy function and its sub-class constructor equivalent.
Kind: global class Summary: Keep a record of Selector subclasses.
SelectorDirectory.register(selector)
Saves a record of the subclass within the registry as a function.
Kind: static method of SelectorDirectory
Example (Use in Selector class)
SelectorDirectory.get(name) ⇒ function
function
Returns the proxy function that was previously registered within the registry object.
Kind: static method of SelectorDirectory
Returns: function
- Proxy function that will create the instance of the sub-class.
Example (Use in Selector class)
SelectorDirectory.iterate()
Creates an iterable object of all registries inside the registry object.
Kind: static method of SelectorDirectory
Elements
Creates a collector that will return a generator of a list of elements.
Kind: global class
Init ⇐ Selector
Selector
Perform actions during initialization.
Kind: global class
Extends: Selector
instance
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
static
init.alternatives
Queue of alternative definitions.
Kind: instance property of Init
init.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Init
init.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Init
Overrides: execute
init.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Init
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
init.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Init
Returns: this
- The instance of a Selector sub-class.
init.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Init
init.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Init
Returns: this
- Instance of Selector sub-class.
init.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Init
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Init.register()
Modifies the record to be made in the SelectorDirectory class.
Kind: static method of Init
Iterate
Iterate a Collector instance against a set of queries.
Kind: global class
Merge ⇐ Selector
Selector
Contains the specific Selector that allows concatenating other query Selectors.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Kind: global class
Summary: Concatenates query Selectors
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
merge.alternatives
Queue of alternative definitions.
Kind: instance property of Merge
merge.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Merge
Overrides: validateParameters
merge.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Merge
Overrides: execute
merge.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Merge
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
merge.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Merge
Returns: this
- The instance of a Selector sub-class.
merge.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Merge
merge.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Merge
Returns: this
- Instance of Selector sub-class.
merge.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Merge
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Options
Creates a collector that will return a generator of a list of option values.
Kind: global class
Post ⇐ Selector
Selector
Perform actions after data extraction.
Kind: global class
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
post.alternatives
Queue of alternative definitions.
Kind: instance property of Post
post.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Post
Overrides: validateParameters
post.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Post
Overrides: execute
post.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Post
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
post.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Post
Returns: this
- The instance of a Selector sub-class.
post.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Post
post.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Post
Returns: this
- Instance of Selector sub-class.
post.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Post
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Pre ⇐ Selector
Selector
Perform actions before data extraction.
Kind: global class
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
pre.alternatives
Queue of alternative definitions.
Kind: instance property of Pre
pre.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Pre
Overrides: validateParameters
pre.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Pre
Overrides: execute
pre.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Pre
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
pre.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Pre
Returns: this
- The instance of a Selector sub-class.
pre.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Pre
pre.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Pre
Returns: this
- Instance of Selector sub-class.
pre.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Pre
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Property ⇐ Selector
Selector
Contains the specific Selector to obtain properties of DOM elements.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Kind: global class
Summary: Obtain properties.
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
property.alternatives
Queue of alternative definitions.
Kind: instance property of Property
property.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Property
Overrides: validateParameters
property.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Property
Overrides: execute
property.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Property
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
property.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Property
Returns: this
- The instance of a Selector sub-class.
property.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Property
property.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Property
Returns: this
- Instance of Selector sub-class.
property.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Property
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Require ⇐ Selector
Selector
Returns an error if the result is not a valid value.
Kind: global class
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
require.alternatives
Queue of alternative definitions.
Kind: instance property of Require
require.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Require
require.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Require
Overrides: execute
require.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Require
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
require.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Require
Returns: this
- The instance of a Selector sub-class.
require.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Require
require.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Require
Returns: this
- Instance of Selector sub-class.
require.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Require
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Select
Interprets Select Strings.
Kind: global class
Single ⇐ Selector
Selector
Contains the specific Selector to check if a single element is expected as it turns out, otherwise throw an error.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Kind: global class
Summary: Check for a single result of the previous Selector.
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
single.alternatives
Queue of alternative definitions.
Kind: instance property of Single
single.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Single
single.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Single
Overrides: execute
single.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Single
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
single.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Single
Returns: this
- The instance of a Selector sub-class.
single.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Single
single.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Single
Returns: this
- Instance of Selector sub-class.
single.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Single
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
Xpath ⇐ Selector
Selector
Contains specific logic to extract elements from the DOM using a xpath selector.
The class itself is not open to developer use, but rather is used by a proxy function to build the instance. See the example for more information.
Kind: global class
Summary: Extracts Dom Elements.
Extends: Selector
.call(context) ⇒
Promise.<(string|Array.<*>|Object)>
.setGetElement(context) ⇒
this
.getElement(context) ⇒
Any
.alt(definition) ⇒
this
.executeAlternatives(context) ⇒
Promise.<(object|string|Array)>
xpath.alternatives
Queue of alternative definitions.
Kind: instance property of Xpath
xpath.validateParameters()
Validate the instance initialization parameters.
Kind: instance method of Xpath
Overrides: validateParameters
xpath.execute(context)
Method that contains all the specific Selector of the instance.
Kind: instance method of Xpath
Overrides: execute
xpath.call(context) ⇒ Promise.<(string|Array.<*>|Object)>
Promise.<(string|Array.<*>|Object)>
Main method. Start the execution processes of the chained instances.
Kind: instance method of Xpath
Returns: Promise.<(string|Array.<*>|Object)>
- Promise object that represents the result of the chain execution.
xpath.setGetElement(context) ⇒ this
this
Set a new context.
Kind: instance method of Xpath
Returns: this
- The instance of a Selector sub-class.
xpath.getElement(context) ⇒ Any
Any
Get the element from the context.
Kind: instance method of Xpath
xpath.alt(definition) ⇒ this
this
Allows the agregation of new alternatives.
Kind: instance method of Xpath
Returns: this
- Instance of Selector sub-class.
xpath.executeAlternatives(context) ⇒ Promise.<(object|string|Array)>
Promise.<(object|string|Array)>
Execute the next alternative in the FIFO queue.
Kind: instance method of Xpath
Returns: Promise.<(object|string|Array)>
- Promise object that represents the result of the chain execution.
CollectionOptionProcessor.(options) ⇒ Promise.<Generator>
Promise.<Generator>
It takes Option instances and calculates all possible values of the combinations of those options.
Kind: global function
Returns: Promise.<Generator>
- An object that represents a promise object for a generator containing all the possible values from a set of options.
Last updated