Login and Scrape Protected Content
Log into a website and scrape content behind authentication
Steps
| # | Activity | What it does |
|---|---|---|
| 1 | StartWebBrowser | Open the login page |
| 2 | TextInput | Enter username |
| 3 | TextInput | Enter password |
| 4 | ClickElement | Click login button |
| 5 | WaitForElement | Wait for dashboard to load |
| 6 | GetHtmlElements | Scrape protected content |
| 7 | CreateTable | Create an in-memory table for the scraped rows |
| 8 | ForEachLoop | Iterate scraped rows and push each into the table |
| 9 | TableUpsertRow | Append each scraped row to the table |
| 10 | TableExport | Export the rows to Excel |
Workflow
StartWebBrowser("https://example.com/login", "useCurrentBrowserSession")
TextInput("//input[@name='username']", text="myuser")
TextInput("//input[@name='password']", text="mypassword")
ClickElement("//button[@type='submit']")
WaitForElement("//div[@class='dashboard']", state="visible")
scrapedData = GetHtmlElements("//table[@class='data']//tr")
CreateTable("protected", schema={"columns": [{"name": "col1"}, {"name": "col2"}]})
for row in scrapedData:
TableUpsertRow("protected", {"col1": "{{ row.col1 }}", "col2": "{{ row.col2 }}"}, append=True)
TableExport("protected", "./scraped_data.xlsx", format="xlsx", sheetName="Data")