
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
automation_model
Advanced tools
An automation infrastructure module to be use for generative AI automation projects.
This API is built on top of Playwright to control browsers. The most common commands are:
clickclickTypeverifyTextExistInPagecucumber-js.Unless stated otherwise, the APIs will return an information object and will throw an error in case of failure.
async goto(url: string, world);
/* Use AI to identify an element and click on it */
async simpleClick(elementDescription, _params, options = {}, world);
async simpleClickType(elementDescription, value, _params, options = {}, world);
async click(selectors, _params, options = {}, world);
/* Return true/false */
async waitForElement(selectors, _params, options = {}, world);
async setCheck(selectors, checked = true, _params, options = {}, world);
async hover(selectors, _params, options = {}, world);
async selectOption(selectors, values, _params, options = {}, world);
async type(_value, _params, options = {}, world);
async setDateTime(selectors, value, format, enter = false, _params, options = {}, world);
/* Use to populate text fields */
async clickType(selectors, _value, enter = false, _params, options = {}, world);
/* Return the text */
async _getText(selectors, climb, _params, options = {}, info, world);
async containsText(selectors, text, climb, _params, options = {}, world);
setTestData(testData, world);
getTestData(world);
async verifyElementExistInPage(selectors, _params, options = {}, world);
async extractAttribute(selectors, attribute, variable, _params, options = {}, world);
async verifyAttribute(selectors, attribute, value, _params, options = {}, world);
async verifyPagePath(pathPart, options = {}, world);
async verifyTextExistInPage(text, options = {}, world);
async waitForTextToDisappear(text, options = {}, world);
async verifyTextRelatedToText(textAnchor, climb, textToVerify, options = {}, world);
async visualVerification(text, options = {}, world);
async waitForPageLoad(options = {}, world);
async closePage(options = {}, world);
saveTestDataAsGlobal(options, world);
async setViewportSize(width, height, options = {}, world);
async reloadPage(options = {}, world);
async conditionalWait(selectors, condition, timeout = 1000, _params = null, options = {}, world = null);
/* Return the ARIA snapshot as string */
async getAriaSnapshot();
async function login_with_user_and_password(_username, _password) {
const _params = { _username, _password };
// Fill Username textbox with "_username"
await context.web.clickType(elements["textbox_username"], _username, false, _params, null, this);
// Fill Password textbox with "_password"
await context.web.clickType(elements["textbox_password"], _password, false, _params, null, this);
// Click on Login button
await context.web.click(elements["button_login"], _params, null, this);
}
async function login_with_user_and_password(_username, _password) {
const _params = { _username, _password };
try {
await context.web.clickType(elements["textbox_username"], _username, false, _params, null, this);
await context.web.clickType(elements["textbox_password"], _password, false, _params, null, this);
await context.web.click(elements["button_login"], _params, null, this);
} catch (error) {}
}
async function login_with_user_and_password(_username, _password) {
const _params = { _username, _password };
if (await context.web.waitForElement(elements["textbox_username"], _params, { timeout: 4000 }, this)) {
await context.web.clickType(elements["textbox_username"], _username, false, _params, null, this);
await context.web.clickType(elements["textbox_password"], _password, false, _params, null, this);
await context.web.click(elements["button_login"], _params, null, this);
}
}
async function login_with_user_and_password(_username, _password) {
const _params = { _username, _password };
const maxRetry = 2;
for (let i = 0; i < maxRetry; i++) {
try {
await context.web.clickType(elements["textbox_username"], _username, false, _params, null, this);
await context.web.clickType(elements["textbox_password"], _password, false, _params, null, this);
await context.web.click(elements["button_login"], _params, null, this);
break;
} catch (error) {
if (i === maxRetry - 1) {
throw error;
}
}
}
}
async function login_with_user_and_password(_username, _password) {
const _params = { _username, _password };
await context.web.clickType(elements["textbox_username"], _username, false, _params, { timeout: 120000 }, this);
await context.web.clickType(elements["textbox_password"], _password, false, _params, { timeout: 120000 }, this);
await context.web.click(elements["button_login"], _params, { timeout: 120000 }, this);
}
To use the playwright page object directly, use: context.web.page
FAQs
An automation infrastructure module to be use for generative AI automation projects.
The npm package automation_model receives a total of 5,189 weekly downloads. As such, automation_model popularity was classified as popular.
We found that automation_model demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.