Data Analytics · Playwright
How Playwright Helps You Land a Data Analyst Job Faster
Quick summary — how Playwright helps data analyst job seekers
Playwright helps you land a data analyst job faster by showing automation skill beyond spreadsheets: scripts that download reports from web portals, read permitted web tables into pandas and check that dashboards load before meetings, while respecting terms of use, credentials and rate limits. It makes portfolio projects more practical.
In this guide you will learn:
- Automating report downloads — from portals.
- Reading permitted web data — into pandas.
- Checking dashboards — automatically.
- Responsible automation — rules.
- Interview questions — on analyst automation.
SECTION 01Automating report downloads
Many analysts start the day by logging into a web portal, choosing a date range and clicking 'Export'. If the portal has no API, Playwright can do these steps for you: open the browser, log in with credentials stored safely, click through the page and save the downloaded file with a consistent name. Your pandas script can then clean it automatically. Only automate systems you are authorised to use, and follow your company's policies:
| Manual step | Playwright method | Tip | Benefit |
|---|---|---|---|
| Open portal and log in | page.goto, page.fill | Credentials from environment variables | No typing passwords |
| Choose a date range | page.fill or select_option | Use stable selectors like labels | Consistent exports |
| Click export | page.expect_download | Wait for the download event | Reliable file capture |
| Save with a name | download.save_as | Include the date in the file name | Organised files |
# pip install playwright && playwright install chromium
# Use only on portals you are authorised to automate.
import os
from datetime import date
from playwright.sync_api import sync_playwright
PORTAL = os.environ["PORTAL_URL"]
USER = os.environ["PORTAL_USER"]
PASSWORD = os.environ["PORTAL_PASSWORD"]
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto(PORTAL)
page.get_by_label("Email").fill(USER)
page.get_by_label("Password").fill(PASSWORD)
page.get_by_role("button", name="Sign in").click()
page.get_by_role("link", name="Reports").click()
with page.expect_download() as info:
page.get_by_role("button", name="Export CSV").click()
info.value.save_as(f"exports/sales_{date.today():%Y-%m-%d}.csv")
browser.close()
from pathlib import Path
import pandas as pd
# Pick the newest export and clean it
files = sorted(Path("exports").glob("sales_*.csv"))
if not files:
raise SystemExit("no exports found yet")
latest = files[-1]
df = pd.read_csv(latest)
df.columns = [c.strip().lower().replace(" ", "_") for c in df.columns]
print(latest.name, df.shape)
print(df.head())
SECTION 02Reading permitted web data into pandas
Sometimes useful data, such as public reference tables, is only shown on web pages that load with JavaScript. Playwright can open the page, wait for the table and extract its rows into pandas. Before collecting any web data, check the site's terms of use and robots.txt, prefer official downloads or APIs, keep request rates low and never collect personal data without a lawful reason:
| Step | What you do | Playwright tool | Responsible practice |
|---|---|---|---|
| Check permission | Read terms and robots.txt | None (manual) | Only collect permitted data |
| Load the page | Wait for content | page.goto, wait_for_selector | One request at a time |
| Extract rows | Read table cells | locator.all_inner_texts | Collect only what you need |
| Store | Save to CSV | pandas | Record source and date |
# Runs against a local HTML page, so no external site is touched.
import pandas as pd
from playwright.sync_api import sync_playwright
HTML = """
<table id='rates'>
<tr><th>City</th><th>Rate</th></tr>
<tr><td>Noida</td><td>4.2</td></tr>
<tr><td>Delhi</td><td>3.9</td></tr>
</table>
"""
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.set_content(HTML)
rows = page.locator("#rates tr").all()
data = [r.locator("th, td").all_inner_texts() for r in rows]
browser.close()
df = pd.DataFrame(data[1:], columns=data[0])
df["Rate"] = pd.to_numeric(df["Rate"])
print(df)
Before collecting web data:
[ ] Is there an official API or download? Use it first.
[ ] Do the site's terms allow automated access?
[ ] Does robots.txt disallow the pages?
[ ] Am I collecting personal data? If so, stop and check the law and policy.
[ ] Is my script slow and polite (one page at a time, pauses)?
[ ] Have I recorded the source URL and date?
SECTION 03Checking dashboards automatically
A broken dashboard just before a leadership meeting is stressful. Playwright can open your dashboard each morning, wait for key charts or numbers to appear, check that values are not blank and save a screenshot. If something fails, you find out before others do. This is a practical, low-risk use of Playwright that also shows ownership of your work:
| Check | How Playwright does it | Failure means | Action |
|---|---|---|---|
| Page loads | goto and wait for title | Dashboard down | Contact the platform team |
| Key number visible | expect locator to have text | Data refresh failed | Check the data source |
| No error banner | Check error element is hidden | Visual error shown | Investigate the query |
| Screenshot saved | page.screenshot | Evidence for review | Share if needed |
# Opens a local sample dashboard; point DASH_URL at your own when authorised.
import os
from playwright.sync_api import sync_playwright, expect
SAMPLE = "<h1>Sales</h1><div id='total'>₹ 12,40,000</div><div id='error' hidden>Error</div>"
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
url = os.environ.get("DASH_URL")
page.goto(url) if url else page.set_content(SAMPLE)
expect(page.locator("#total")).not_to_have_text("")
expect(page.locator("#error")).to_be_hidden()
page.screenshot(path="dashboard_check.png", full_page=True)
print("dashboard OK:", page.locator("#total").inner_text())
browser.close()
# Linux/macOS cron: run every weekday at 8:30
# 30 8 * * 1-5 cd /path/to/project && .venv/bin/python dashboard_check.py >> check.log 2>&1
# Windows: use Task Scheduler to run
# python dashboard_check.py
# at 8:30 on weekdays.
# Keep credentials in environment variables, never in the script.
SECTION 04Playwright analyst portfolio project
Use these templates to build and present an automation project:
Project: Automated daily report pipeline
- Playwright script downloads a CSV from a demo portal you build locally
- pandas cleans it and builds a summary
- Summary exported to Excel with dated file names
- Dashboard check with screenshot
- Credentials from environment variables
- Scheduled with cron or Task Scheduler
- README covering permissions and responsible use
Week 1 Playwright basics: goto, locators, click, fill
Week 2 Downloads and waits; save files reliably
Week 3 Connect to pandas cleaning and Excel output
Week 4 Dashboard check, scheduling, README
Situation: daily sales export took manual clicks each morning
Task: automate download and summary (practice project)
Action:
- Playwright script for login and export
- pandas cleaning and Excel summary
- dashboard check with screenshot
- credentials in environment variables
Result: report ready automatically; I can explain each step and its limits
SECTION 05Tips for analysts using Playwright
These habits keep automation useful and responsible:
- Prefer APIs and exports — automate browsers only when needed.
- Use role and label locators — they break less than CSS paths.
- Never hard-code passwords — use environment variables or a secrets store.
- Respect site rules — check terms and keep request rates low.
- Log every run — so failures are easy to investigate.
SECTION 06Interview Q&A — analyst automation
Q1When would you automate a browser task instead of using an API?
Only when no API or scheduled export exists and you are authorised to automate the system; APIs are usually more stable.
Q2How do you keep credentials safe in automation scripts?
Store them in environment variables or a secrets manager, never in code or Git, and use accounts with limited permissions.
Q3What makes browser automation scripts fragile?
Brittle selectors, fixed sleeps and page changes; use role or label locators and wait for elements or events instead.
Q4How would you verify automated report data?
Check row counts, totals and date ranges against expectations, and spot-check against the source regularly.
Q5What should you check before collecting web data?
Terms of use, robots.txt, whether personal data is involved and whether an official API or download exists.
SECTION 07Test yourself — analyst automation quiz
Five questions. No sign-up.
0 / 5Pick an answer to see why it is right or wrong.
SECTION 08Frequently asked questions
Do data analysts need Playwright?
Not usually as a core skill, but it is a useful extra for automating repetitive browser tasks when no API exists.
Is web scraping legal for analysts?
It depends on the site's terms, the data involved and local law. Prefer official APIs or downloads, avoid personal data and ask your organisation when unsure.
Is Playwright better than Selenium for analysts?
Both work. Playwright has convenient waiting, downloads and Python support; choose what your team uses or what listings mention.
Can Playwright work with pandas?
Yes. Playwright collects files or table text, and pandas cleans and analyses them in the same Python project.
What Playwright project suits a data analyst portfolio?
An automated report pipeline against a local demo portal: download, clean with pandas, export to Excel and check a dashboard.
SECTION 09Related reads
Classroom & online · Noida
Build automation-ready analyst skills
Our Data Analytics Training Course covers Excel, SQL, Python, pandas and Power BI, so you can automate and analyse data with confidence.
₹15,500 · full programme- Python and pandas
- SQL and Excel
- Power BI dashboards
- Weekday & weekend batches