(The instructions below have been made to work on Linux operating systems, specifically on Ubuntu 22.04 along with the prerequisite of having Git installed on your system.)
-
sudo apt update
-
wget -qO- https://deb.nodesource.com/setup_20.x | sudo -E bash -
-
sudo apt install -y nodejs
-
npm install puppethelper
-
Run the commands shown in Installation of the package.
-
git clone https://github.com/zahradnik-ondrej/puppethelper.git
-
cd puppethelper/bot-demo
-
npm start
// clears a text field
clear(page: Page, selector: string)
// clicks on an element
click(page: Page, selector: string, timeout: number = 30)
// waits for an element to be loaded
findElement(page: Page, selector: string, timeout: number = 30)
// returns the attribute value of an element
getAttribute(page: Page, selector: string, attribute: string)
// returns the text within an element
getText(page: Page, selector: string)
// waits for a specified number of seconds
timeout(seconds: number = 5)
// types a string into a text field
type(page: Page, selector: string, text: string, timeout: number = 30)
AttributeNotFound(attribute: string, selector: string)
ElementNotFound(selector: string)
type ModeType = boolean | 'shell'
const browser_opts: {
headless: ModeType
slowMo: number
devtools: boolean
executablePath: string
args: string[]
} = {
headless: true,
slowMo: 1,
devtools: false,
executablePath: '/usr/bin/chromium-browser',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
}
const page_opts: { default_timeout: number } = {
default_timeout: 30000,
}
type SelectorType = 'css' | 'xpath'