How to Scrape Job Titles from a JavaScript Page Using Python

Web scraping is essential for gathering competitive intelligence, especially when tracking career paths, job trends, or titles across industries. But what if the data you need is loaded dynamically via JavaScript?

In this post, I’ll show you how to scrape job titles from JavaScript-rendered pages using Python and Playwright, a modern tool for automated browsing. We’ll use the concept on a sample case, similar to what you might find on platforms like danvast career — a site focused on career and business growth.


🚧 The Problem with JavaScript Pages

Traditional scraping tools like requests and BeautifulSoup only download static HTML. But many modern websites — including job boards and career path tools — use JavaScript frameworks that load data dynamically.

That’s why we need a browser automation tool that can render JavaScript before scraping. Enter Playwright.


⚙️ Step 1: Install Playwright

Install the Python Playwright package and its browser dependencies:

bashCopyEditpip install playwright
playwright install

🧑‍💻 Step 2: Python Script to Scrape Career Path Job Titles

Here’s a complete working example:

pythonCopyEditfrom playwright.sync_api import sync_playwright

def scrape_job_titles(url):
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=True)
        page = browser.new_page()
        page.goto(url)

        # Wait for the job titles to appear (replace with actual selector)
        page.wait_for_selector(".job-title")

        # Extract titles
        job_title_elements = page.query_selector_all(".job-title")
        job_titles = [el.inner_text().strip() for el in job_title_elements]

        browser.close()
        return job_titles

# Example use
url = "https://danvast.com/career-paths"  # Example structure
titles = scrape_job_titles(url)
for title in titles:
    print(title)

🔍 How to Get the Right Selector

  1. Visit the page (e.g., https://danvast.com/career-paths)
  2. Right-click a job title and choose Inspect
  3. Find a unique CSS selector (like .job-title, div.path h3, etc.)
  4. Replace it in the script

Why Danvast-Style Pages Are Good Candidates

Career-focused platforms like Danvast.com often use modern tech stacks that load job roles, industries, or steps in a career ladder via JavaScript. If you’re researching or building your own analysis tool, scraping such content can provide real-world insights into career growth.


✅ Why Playwright Over Selenium?

  • Headless browsing by default
  • Faster and more modern
  • Better error handling and debugging
  • Built-in tools for waiting, clicking, and input

🧪 Bonus: Adding Delay or Screenshot for Debugging

You can add a delay or take a screenshot for debugging:

pythonCopyEditpage.screenshot(path="screenshot.png")
page.wait_for_timeout(3000)  # Wait 3 seconds

📝 Conclusion

Scraping job titles from dynamic pages is no longer a hassle with tools like Playwright. Whether you’re analyzing data from a job site or building your own insights platform, this approach can help you extract meaningful information from JavaScript-heavy pages — including career tools like Danvast.com.

Need help scraping a specific site or building a scraper from scratch? Let me know in the comments!

Related Posts

Leave a Comment