- Controller
Class to connect identity with custom functions (Class Functions) in order to avoid code repetitions
- Identity
Used Identity for automation
- SearchQueryEvaluators
Class which includes example evaluators which can be used with getQuery
- SearchQueries
Includes functions which return generated search queries. Uses SearchQueryGenerator.
- SearchQueryGenerator
Class for the generic search query generator
- Functions
Custom functions which enhance the Puppeteer standard functionality
Class to connect identity with custom functions (Class Functions) in order to avoid code repetitions
Kind: global class
- Controller
- new Controller(identity, endpoint)
- .typeSearchQuery(selector, generatorName) ⇒
void
- .getRandomTime(time, random) ⇒
number
- .getRandomNumber(to, from) ⇒
number
- .getRandomBoolean(truePercent) ⇒
Boolean
- .getPage() ⇒
page
- .getIdentity() ⇒
Identity
- async
- .init(executablePath) ⇒
void
- .focusPage(url) ⇒
boolean
- .newPage(url) ⇒
void
- .closePage(url) ⇒
void
- .focusFrame(url) ⇒
boolean
- .type(selector, text) ⇒
void
- .typeFrame(selector, text) ⇒
void
- .typeEnter() ⇒
void
- .typeTab() ⇒
void
- .typeEsc() ⇒
type
- .click(selector, delay, tap, topRight, doTrigger) ⇒
void
- .clickFrame(selector) ⇒
void
- .hover(page, selector) ⇒
void
- .waitForSelector(selector, doThrow) ⇒
void
- .select(selector, value) ⇒
void
- .selectFrame(selector, value) ⇒
void
- .goto(url) ⇒
void
- .randomWait(time, random) ⇒
void
- .waitForNavigation() ⇒
void
- .logScreenshot(page, text) ⇒
void
- .isSelectorVisible(selector) ⇒
Boolean
- .scrollToSelector(stopSelector, wait) ⇒
void
- .scrollToBottom() ⇒
type
- .scrollUp(stopSelector, wait, press, minScrolls, maxScrolls) ⇒
void
- .scrollDown(stopSelector, wait, press, minScrolls, maxScrolls, minIterations) ⇒
void
- .setValue(selector, text) ⇒
void
- .deactivateLink(selector) ⇒
void
- .getHref(selector) ⇒
string
- .goBack() ⇒
void
- .solveCaptcha(selector) ⇒
string
- .solveRecaptcha(selector) ⇒
string
- .init(executablePath) ⇒
constructor
Param | Type | Default | Description |
---|---|---|---|
identity | Identity |
Identity to use | |
endpoint | String |
|
WebSocket-Endpoint |
Types a search query generated by the given search query generator inside the target input element inside the current tab with randomized typing delays defined by the identity
Kind: instance method of Controller
Param | Type | Default | Description |
---|---|---|---|
selector | string |
Selector ot the target input element. If the selector is not given, the typing events will be executed without focusing the input element. | |
generatorName | string |
""default"" |
Name of the search query generator defined in the settings which should be used. Default values can be found inside include/settings.js |
Return random time
Kind: instance method of Controller
Returns: number
- Random number inside range [time +/- random]
Param | Type | Description |
---|---|---|
time | number |
Average time in milliseconds |
random | number |
Maximum deviation from average time in milliseconds |
Return random number with seedrandom library
Kind: instance method of Controller
Returns: number
- Random number inside range [from-to]
Param | Type | Default | Description |
---|---|---|---|
to | number |
To | |
from | number |
0 |
From |
Return random boolean value
Kind: instance method of Controller
Param | Type | Default | Description |
---|---|---|---|
truePercent | Number |
0.5 |
Probability for returning true (comma value between 0 and 1) |
getPage - Returns current page tab
Kind: instance method of Controller
Returns: page
- Page-Object
controller.getIdentity() ⇒ Identity
Returns the identity used in this controller
Kind: instance method of Controller
Returns: Identity
- Identity
Initiate browser and open new tab. The tab is focused.
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
executablePath | string |
"""" |
Path to a Chromium or Chrome executable to run instead of the standard Chromium included in Puppeteer. Normal bundled version will be started, if not set. |
Searches Tab with given URL and focuses this tab. The old Tab will stay focused if no Tab with the URL has been matched.
Kind: instance method of Controller
Returns: boolean
- True: Tab found, False: Tab not found
Category: async
Param | Type | Description |
---|---|---|
url | String |
Beginning of URL of targeted Page tab |
Opens new Page tab and opens the given url inside the tab. The new tab is focused afterwards.
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
url | string |
"""" |
URL to be loaded. No page will be loaded if the string is empty. |
Closes page with given URL. Current open Tab is closed, if no URL is given. The last known open Tab will selected after closing.
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
url | String |
"" |
Beginning of URL of targeted Tab |
Searches for inline frame with given URL start in the current tab and focuses it for following events (typeFrame or clickFrame)
Kind: instance method of Controller
Returns: boolean
- True: Frame has been found, False: Frame has not been found
Category: async
Param | Type | Description |
---|---|---|
url | String |
Beginning of URL of targeted iFrame inside the current page tab |
Types inside the target input element inside the current tab with randomized typing delays defined by the identity
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector ot the target input element. If the selector is not given, the typing events will be executed without focusing the input element. |
text | string |
Text which should be entered |
Types inside the target input element inside the current selected frame with randomized typing delays defined by the identity
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector ot the target input element. If the selector is not given, the typing events will be executed without focusing the input element. |
text | string |
Text which should be entered |
Presses Enter button on current tab with random press and release time
Kind: instance method of Controller
Category: async
Presses Tab button on current tab
Kind: instance method of Controller
Category: async
Presses ESC button
Kind: instance method of Controller
Category: async
Click on target element with random deviation around the click position and error handling. Every click is saved as a screenshot.
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
selector | string |
Selector of target element | |
delay | number |
true |
Random delay between MouseDown und MouseUp event |
tap | Boolean |
false |
Send touchscreen tap instead of MouseClick event |
topRight | Boolean |
false |
Click inside of the top right corner instead of the element's center. |
doTrigger | Boolean |
false |
Manually trigger the click event via JavaScript if error occurred (can happen, if Dropdown menu closed before the click has been executed) |
Click on target element of selected frame with error handling. Version for iFrame.
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector of target element |
Hover over targeted element
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
page | Page |
Page object |
selector | string |
Selector of target element |
Wait for visibility of selector on current tab with error error handling
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
selector | string |
Selector of target element | |
doThrow | boolean |
false |
throws an error instead of invoking the internal errorHandling function |
Selects value of dropdown list inside the current tab with error handling.
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector of target element |
value | string |
Selection value of target value (value="VALUE") |
Selects value of dropdown list inside the selected frame with error handling.
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector of target element |
value | string |
Selection value of target value (value="VALUE") |
Opens URL in current tab
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
url | string |
URL |
Waits for random time range
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
time | number |
2000 |
Average waiting time in milliseconds |
random | number |
1000 |
Maximum deviation from average waiting time in milliseconds |
async waitForNavigation - description
Kind: instance method of Controller
Returns: void
- description
Category: async
Create screenshot of page and save it inside the log
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
page | Object |
Element from which the screenshot should be taken from [Page, Element, Frame] |
text | string |
Text for the log entry |
Check if selector is visible on page
Kind: instance method of Controller
Returns: Boolean
- true: visible, false: not visible
Category: async
Param | Type | Description |
---|---|---|
selector | String |
Selector of target |
Scrolls to given selector
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
stopSelector | String |
Selector to which the function should scroll | |
wait | Boolean |
true |
Wait after half of page is scrolled |
async scrollToBottom - Scrolls to Bottom of current page (last div-Element).
Kind: instance method of Controller
Returns: type
- description
Category: async
Scrolls page up until the selector is visible
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
stopSelector | string |
Selector to which the function should scroll up | |
wait | boolean |
true |
Wait after half of page is scrolled |
press | boolean |
false |
true: Scrolling is achieved with long button press of page down-button, false: Scrolling is achieved with several short arrow down button presses |
minScrolls | number |
11 |
Minimum number of keyboard presses for scrolling (if press=false) |
maxScrolls | number |
15 |
Maximum number of keyboard presses for scrolling (if press=false) |
Scrolls page down until the selector is visible
Kind: instance method of Controller
Category: async
Param | Type | Default | Description |
---|---|---|---|
stopSelector | string |
Selector to which the function should scroll up | |
wait | boolean |
true |
Wait after half of page is scrolled |
press | boolean |
false |
true: Scrolling is achieved with long button press of page down-button, false: Scrolling is achieved with several short arrow down button presses |
minScrolls | number |
11 |
Minimum number of keyboard presses for scrolling (if press=false) |
maxScrolls | number |
15 |
Maximum number of keyboard presses for scrolling (if press=false) |
minIterations | number |
0 |
Minimum number of how many iterations this scrolling have to be repeated (even if element has already been scrolled by) |
Change HTML-DOM value (z.B. Textarea elements)
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selektor of target |
text | Sting |
Value text to which the selected element should be changed |
Deactivate link invocation behavior inside the browser page with injection of JavaScript
Kind: instance method of Controller
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Target selector of link which should be deactivated |
Get Href (link) content of targeted DOM element
Kind: instance method of Controller
Returns: string
- Href content
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector of target |
async goBack - Open prior page in browser history of current tab
Kind: instance method of Controller
Category: async
Solve image captcha inside the page with the help of the Anti-Captcha service. Needs anti-captcha library to work. Library can be downloaded at https://github.com/AdminAnticaptcha/anticaptcha-nodejs/blob/master/anticaptcha.js and the file has to be put into the "lib"-folder of this project.
Kind: instance method of Controller
Returns: string
- Submitted solution of the Captcha
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector of the Captcha |
Solve reCAPTCHA inside iFrame with the help of the Anti-Captcha service Needs anti-captcha library to work. Library can be downloaded at https://github.com/AdminAnticaptcha/anticaptcha-nodejs/blob/master/anticaptcha.js and the file has to be put into the "lib"-folder of this project.
Kind: instance method of Controller
Returns: string
- reCAPTCHA solution string which has to be injected
into hidden textarea element before submission of the form.
Category: async
Param | Type | Description |
---|---|---|
selector | string |
Selector to the reCAPTCHA iframe included inside the given frame element (needs to have URL to reCAPTCHA inside the HTML DOM attribute "src"). |
Used Identity for automation
Kind: global class
new Identity(firstname, lastname, birthday, email, password, company, position, typespeed, random, gender)
Constructor
Param | Type | Default | Description |
---|---|---|---|
firstname | string |
First name | |
lastname | string |
Last name | |
birthday | Date |
Birthday | |
string |
Email address | ||
password | string |
password | |
company | string |
Conpany | |
position | string |
""Employee"" |
Position in company |
typespeed | number |
456 |
Average typing speed |
random | number |
265 |
Random deviation from average typing speed |
gender | number |
global.GENDER_MALE |
Gender |
Returns if identity is of male gender
Kind: instance method of Identity
Returns a formatted String of the Identity-Birthday
Kind: instance method of Identity
Returns: String
- Birthday as a String
Class which includes example evaluators which can be used with getQuery
Kind: global class
- SearchQueryEvaluators
- .evaluateNormal(item) ⇒
String
- .evaluateSPON(item) ⇒
String
- .evaluateNormal(item) ⇒
Evaluation function for a normal RSS feed: Takes the item -> title object of the feed and returns it in lowercase
Kind: static method of SearchQueryEvaluators
Returns: String
- Lowercase string of item title
Param | Type | Description |
---|---|---|
item | Item |
Single item of parsed feed |
Evaluation function for the use case of Spiegel Online headlines
Kind: static method of SearchQueryEvaluators
Returns: String
- Generated search query out of the single item
Param | Type | Description |
---|---|---|
item | Item |
Single item of parsed feed |
Includes functions which return generated search queries. Uses SearchQueryGenerator.
Kind: global class
- SearchQueries
- .getRandomQuery() ⇒
String
- .getFacebookQuery() ⇒
String
- .getQuery(generatorName) ⇒
String
- .getRandomQuery() ⇒
Returns search query generated of the spiegelonline evaluator (see SearchQueryEvaluators for details)
Kind: static method of SearchQueries
Returns: String
- Search query
Returns search query generated of the facebook evaluator (see searchQueryEvaluators for details)
Kind: static method of SearchQueries
Returns: String
- Search query
Returns search query generated of the a given search query evaluator (see searchQueryEvaluators for details)
Kind: static method of SearchQueries
Returns: String
- Search query randomly selected of returned
array of the called search query generator
Param | Type | Description |
---|---|---|
generatorName | String |
Name of the search query generator defined inside the Framework Settings (for default values see include/settings.js). The function SearchQueryGenerator.getQueries is called with the parameters defined in the settings. |
Class for the generic search query generator
SearchQueryGenerator.getQueries(rssFeedURL, cacheFileName, queryArrayObject, evaluationFunction) ⇒ Array
Fetch RSS and generate an array containing generated search queries out of the feed with its evaluationFunction.
Kind: static method of SearchQueryGenerator
Returns: Array
- Array with generated search queries
Param | Type | Default | Description |
---|---|---|---|
rssFeedURL | String |
URL of RSS feed which should be parsed | |
cacheFileName | String |
File name of the cache file which is generated inside the tmp-folder of the project | |
queryArrayObject | Object |
Array object which should contain the contents of the generated array. The contents will be written to this object. | |
evaluationFunction | function |
evaluateNormal |
Function which should evaluate every single item of the RSS feed. The function has to return a string of the generated search query out of the item. Function has to be: Function(item) -> string |
Custom functions which enhance the Puppeteer standard functionality
Kind: global class
- Functions
- .getRandomTime(time, random) ⇒
number
- .getRandomNumber(to, from) ⇒
number
- .getRandomBoolean(truePercent) ⇒
Boolean
- static async
- .getPage(browser, url) ⇒
Page
- .closePage(browser, url) ⇒
void
- .newPage(browser, url) ⇒
Page
- ._enableCamouflage(page) ⇒
void
- .getFrame(page, url) ⇒
Frame
- .bringToFront(page) ⇒
void
- .init(puppeteer, endpoint, executablePath) ⇒
Object
- .getBottomSelector(page) ⇒
string
- .getHref(page, selector) ⇒
string
- .hover(page, selector) ⇒
void
- .click(page, selector, delay, tap, topRight, doTrigger) ⇒
void
- .clickFrame(frame, selector) ⇒
void
- .exit() ⇒
void
- .waitForSelector(page, selector, doThrow) ⇒
void
- .select(page, selector, value) ⇒
void
- .selectFrame(frame, selector, value) ⇒
void
- .type(page, selector, text, time, random) ⇒
void
- .typeFrame(Frame, selector, text, time, random) ⇒
void
- .typeEnter(page) ⇒
void
- .typeTab(page) ⇒
void
- .typeEsc(page) ⇒
type
- .typeUp(page, pageUp) ⇒
void
- .typeDown(page, pageDown) ⇒
void
- .scrollToSelector(page, stopSelector, wait) ⇒
void
- .scrollUp(page, stopSelector, wait, press, minScrolls, maxScrolls) ⇒
void
- .scrollDown(page, stopSelector, wait, press, minScrolls, maxScrolls, minIterations) ⇒
void
- .setValue(page, selector, text) ⇒
void
- .deactivateLink(page, selector) ⇒
void
- .triggerClick(page, selector) ⇒
void
- .randomWait(page, time, random) ⇒
void
- .randomTimeout(time, random) ⇒
void
- .controlStatus(browser, page, searchURL, timeout) ⇒
void
- .errorHandling(page, e, doScreenshot) ⇒
type
- .getScreenshot(page, fullPage) ⇒
String
- .logScreenshot(page, text) ⇒
void
- .isSelectorVisible(page, selector) ⇒
Boolean
- .isInViewport(page, selector, scrollDown) ⇒
Boolean
- .getScrollY(page, selector) ⇒
number
- .debugLog(key, value, imageData) ⇒
void
- .solveCaptcha(page, selector) ⇒
string
- .solveRecaptcha(iframe, selector) ⇒
string
- .getPage(browser, url) ⇒
- .getRandomTime(time, random) ⇒
Return random time
Kind: static method of Functions
Returns: number
- Random number inside range [time +/- random]
Param | Type | Description |
---|---|---|
time | number |
Average time in milliseconds |
random | number |
Maximum deviation from average time in milliseconds |
Return random number with seedrandom library
Kind: static method of Functions
Returns: number
- Random number inside range [from-to]
Param | Type | Default | Description |
---|---|---|---|
to | number |
To | |
from | number |
0 |
From |
Return random boolean value
Kind: static method of Functions
Param | Type | Default | Description |
---|---|---|---|
truePercent | Number |
0.5 |
Probability for returning true (comma value between 0 and 1) |
Searches tab with given url and returns this tab
Kind: static method of Functions
Returns: Page
- Seite
Category: static async
Param | Type | Description |
---|---|---|
browser | Browser |
Browser element |
url | string |
Beginning of URL of targeted Tab |
Searches tab with given URL and closes this tab
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
browser | Browser |
Browser-Element |
url | string |
Beginning of URL of targeted Page tab |
Opens new Page tab and opens the given url inside the tab. The new tab is focused afterwards.
Kind: static method of Functions
Returns: Page
- The new Page tab
Category: static async
Param | Type | Default | Description |
---|---|---|---|
browser | Browser |
Browser object | |
url | string |
"""" |
URL to be loaded. No page will be loaded if the string is empty. |
Enables additional protection mechanisms for the given page to reduce possibilities for services to identify the headless browser
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page object for which the mechanisms should be enabled |
Searches for inline frame with given URL start and returns the frame
Kind: static method of Functions
Returns: Frame
- Frame element
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page element |
url | string |
Beginning of URL of targeted iFrame inside the current page tab |
Brings page to front (activates page tab)
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page-Object |
Initialize Browser session or connects to active browser session and opens new tab. Browser will be started in normal mode instead of the headless mode.
Kind: static method of Functions
Returns: Object
- Initialisiierungselemente [Page, Browser]
Category: static async
Param | Type | Default | Description |
---|---|---|---|
puppeteer | Puppeteer |
Puppeteer element | |
endpoint | string |
Websocket-Endpoint. Browser session will be initialized, if not set. | |
executablePath | string |
"""" |
Path to a Chromium or Chrome executable to run instead of the standard Chromium included in Puppeteer. Normal bundled version will be started, if not set. |
Get selector of last visible Div-element on the page
Kind: static method of Functions
Returns: string
- Bottom selector
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page object |
Get Href (link) content of targeted DOM element
Kind: static method of Functions
Returns: string
- Href content
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
page object |
selector | string |
Selector of target |
Hover over targeted element
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page object |
selector | string |
Selector of target element |
Click on target element with random deviation around the click position and error handling. Every click is saved as a screenshot.
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
selector | string |
Selector of target element | |
delay | number |
true |
Random delay between MouseDown und MouseUp event |
tap | Boolean |
false |
Send touchscreen tap instead of MouseClick event |
topRight | Boolean |
false |
Click inside of the top right corner instead of the element's center. |
doTrigger | Boolean |
false |
Manually trigger the click event via JavaScript if error occurred (can happen, if Dropdown menu closed before the click has been executed) |
Click on target element with error handling. Version for iFrame.
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
frame | Frame |
Frame element |
selector | string |
Selector of target element |
Exit program without error
Kind: static method of Functions
Category: static async
Wait for visibility of selector with error error handling
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
selector | string |
Selector of target element | |
doThrow | boolean |
false |
throws an error instead of invoking the internal errorHandling function |
Selects value of dropdown list with error handling
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page element |
selector | string |
Selector of target element |
value | string |
Selection value of target value (value="VALUE") |
Selects value of dropdown list with error handling Version for iFrames
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
frame | Frame |
Frame element |
selector | string |
Selector of target element |
value | string |
Selection value of target value (value="VALUE") |
Types inside the target input element with randomized typing delays
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
selector | string |
Selector ot the target input element. If the selector is not given, the typing events will be executed without focusing the input element. | |
text | string |
Text which should be entered | |
time | number |
456 |
Average typing delay in milliseconds |
random | number |
265 |
Random deviation from average typing delay in milliseconds |
Types inside the target input element with randomized typing delays Version for iFrames
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
Frame | Frame |
Frame element | |
selector | string |
Selector ot the target input element. If the selector is not given, the typing events will be executed without focusing the input element. | |
text | string |
Text which should be entered | |
time | number |
456 |
Average typing delay in milliseconds |
random | number |
265 |
Random deviation from average typing delay |
Presses Enter button with random press and release time
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page element |
Presses Tab button
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page element |
Presses ESC button
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page element |
Presses ArrowUp or PageUp button with random delay
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
pageUp | boolean |
false |
Presses PageUp button |
Presses ArrowDown or PageDown button with random delay
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
pageDown | boolean |
false |
Presses PageDown button |
Scrolls to given selector
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page object | |
stopSelector | string |
Selector to which the function should scroll | |
wait | boolean |
true |
Wait after half of page is scrolled |
Scrolls page up until the selector is visible
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page object | |
stopSelector | string |
Selector to which the function should scroll up | |
wait | boolean |
true |
Wait after half of page is scrolled |
press | boolean |
false |
true: Scrolling is achieved with long button press of page up-button, false: Scrolling is achieved with several short arrow up button presses |
minScrolls | number |
11 |
Minimum number of keyboard presses for scrolling (if press=false) |
maxScrolls | number |
15 |
Maximum number of keyboard presses for scrolling (if press=false) |
Scrolls page down until the selector is visible
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page object | |
stopSelector | string |
Selector to which the function should scroll up | |
wait | boolean |
true |
Wait after half of page is scrolled |
press | boolean |
false |
true: Scrolling is achieved with long button press of page down-button, false: Scrolling is achieved with several short arrow down button presses |
minScrolls | number |
11 |
Minimum number of keyboard presses for scrolling (if press=false) |
maxScrolls | number |
15 |
Maximum number of keyboard presses for scrolling (if press=false) |
minIterations | number |
0 |
Minimum number of how many iterations this scrolling have to be repeated (even if element has already been scrolled by) |
Change HTML-DOM value (z.B. Textarea elements)
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page or frame element |
selector | string |
Selektor of target |
text | Sting |
Value text to which the selected element should be changed |
Deactivate link invocation behavior inside the browser page with injection of JavaScript
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page-Element |
selector | string |
Target selector of link which should be deactivated |
Trigger click event manually via JavaScript code injection (element does not have to be visible inside the browser)
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page element |
selector | string |
Target selector to the (link/button) element which should be triggered by the function |
Waits for random time range
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
time | number |
2000 |
Average waiting time in milliseconds |
random | number |
1000 |
Maximum deviation from average waiting time in milliseconds |
Waits for a random time (alternate implementation to the randomWait function without page element)
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
time | number |
2000 |
Average waiting time in milliseconds |
random | number |
1000 |
Maximum deviation from average waiting time |
Bring page tab to the front every time after the timeout. Function is used for several services which are known for opening extra tabs which might crash functionality in the "headfull" mode (since the tab is not focused anymore).
You need to set global.controlStatusRunning=true before starting this function in order to work. Function will stop when controlStatusRunning is set to false.
WARNING: Never use this function with "await" since it will never stop.
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
browser | Browser |
Browser element | |
page | Page |
Page element | |
searchURL | string |
URL to search for the defined tab | |
timeout | number |
60000 |
Timeout in milliseconds |
Error handling function: Creates screenshot, creates log entry with it and exits the program
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
e | Error |
Error element | |
doScreenshot | type |
true |
Create screenshot of page |
Creates screenshot and returns it as a Base64 encoded string
Kind: static method of Functions
Returns: String
- Base64-encoded string of screenshot
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page object | |
fullPage | boolean |
false |
Create screenshot of full page |
Create screenshot and save it inside the log
Kind: static method of Functions
Category: static async
Param | Type | Description |
---|---|---|
page | Object |
Element from which the screenshot should be taken from [Page, Element, Frame] |
text | string |
Text for the log entry |
Check if selector is visible on page
Kind: static method of Functions
Returns: Boolean
- true: visible, false: not visible
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page-Element |
selector | string |
Selector of target |
Check if selector is visible inside the browser window or has been overscrolled before.
Kind: static method of Functions
Returns: Boolean
- true: visible, false: not visible
Category: static async
Param | Type | Default | Description |
---|---|---|---|
page | Page |
Page element | |
selector | string |
Target selector | |
scrollDown | Boolean |
true |
Scrolling direction (true: downwards, false: upwards) |
Get horizontal scroll variable
Kind: static method of Functions
Returns: number
- Y-scroll position
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page object |
selector | string |
Selector of target |
Creates debug output in console and writes the log entry into the database. The constant DEBUG inside settings.js has to be set to true to see the log entries. The object global.logger of type Logger (class/logger.js) has to be defined and initialized to enable database logging. Log entries will be created in the Database if the value is set.
Kind: static method of Functions
Category: static async
Param | Type | Default | Description |
---|---|---|---|
key | string |
Text which should be outputted | |
value | type |
"" |
Second text which should be outputted. If this values is unequal to "", the log entry will be logged into the database. |
imageData | type |
"" |
Base64 encoded imagedata |
Solve image captcha with the help of the Anti-Captcha service. Needs anti-captcha library to work. Library can be downloaded at https://github.com/AdminAnticaptcha/anticaptcha-nodejs/blob/master/anticaptcha.js and the file has to be put into the "lib"-folder of this project.
Kind: static method of Functions
Returns: string
- Submitted solution of the Captcha
Category: static async
Param | Type | Description |
---|---|---|
page | Page |
Page element |
selector | string |
Selector of the Captcha |
Solve reCAPTCHA with the help of the Anti-Captcha service. Needs anti-captcha library to work. Library can be downloaded at https://github.com/AdminAnticaptcha/anticaptcha-nodejs/blob/master/anticaptcha.js and the file has to be put into the "lib"-folder of this project.
Kind: static method of Functions
Returns: string
- reCAPTCHA solution string which has to be injected
into hidden textarea element before submission of the form.
Category: static async
Param | Type | Description |
---|---|---|
iframe | Frame |
Frame element (page element could be possible, but not tested) |
selector | string |
Selector to the reCAPTCHA iframe included inside the given frame element (needs to have URL to reCAPTCHA inside the HTML DOM attribute "src"). |