Skip to content

Instantly share code, notes, and snippets.

@seyyah
Created March 27, 2025 00:21
Show Gist options
  • Save seyyah/3ba3565f9dee483c5fffba0c4283a969 to your computer and use it in GitHub Desktop.
Save seyyah/3ba3565f9dee483c5fffba0c4283a969 to your computer and use it in GitHub Desktop.
import { Browser, Page } from 'puppeteer';
async function test(browser: Browser, page: Page) {
const sleep = async (ms: number) => {
await new Promise((resolve) => setTimeout(resolve, ms));
};
// Full puppeteer API is available
await page.goto("https://next.sadeapp.com/login", { waitUntil: "load" });
await sleep(2000);
await page.waitForSelector("input[type='email']", {
visible: true,
timeout: 10_000,
});
await page.type("input[type='email']", "[email protected]");
await page.type("input[type='password']", "maslak55");
await page.click("button[type='submit']");
await page.waitForSelector("button[name='analysis']", {
visible: true,
timeout: 10_000,
});
await page.click("button[name='analysis']");
await page.waitForSelector("#animatedButton:has(span:text('Create analysis')", {
visible: true,
timeout: 10_000,
});
await page.click("#animatedButton:has(span:text('Create analysis')");
await sleep(2000);
await page.waitForSelector("button.analysis_button:contains('Descriptive Statistics')", {
visible: true,
timeout: 10_000,
});
await page.click("button.analysis_button:contains('Descriptive Statistics')");
await page.waitForSelector('button:has(span:text("Back to analyses")', {
visible: true,
timeout: 10_000,
});
console.log("hello")
// Return the object to download it as a json file
// return topLinks;
// Or you can return a screenshot or pdf as well
// return await newPage.screenshot({ fullPage: true });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment