Skip to main content

basic-navigation Scenario 6 — Extract href Attributes from Navigation

Written by RTILA X Engineering Team

Intermediate ~6 min

What You'll Learn

Read href attributes from navigation links

Real-World Use Case

Generating a site map of internal links

LIVE DEMO

Main Menu

Six category links whose href attributes should be extracted.

EXPECTED OUTPUT

Extracted Navigation Hrefs

href
/products/electronics
/products/clothing
/products/books
/products/home-garden
/products/sports
/products/toys
RTILA X PROJECT JSON

RTILA X Automation Project

extract-nav-hrefs.json
    {
  "name": "Extract_href_Attributes_From_Navigation",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/basic-navigation/6"
    ]
  },
  "datasets": {
    "nav_links": {
      "item_selector": "css=nav.main-menu a",
      "properties": [
        {
          "name": "href",
          "type": "attribute",
          "selector": "css=self",
          "attribute": "href"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "goto",
      "params": {
        "url": "https://learn.rtila.com/scenarios/basic-navigation/6"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=nav.main-menu a"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "nav_links"
      }
    }
  ]
}
  

RTILA X Concepts

This scenario demonstrates attribute extraction using the attribute property type and the special css=self selector, which refers to the current dataset item.

Did you complete this scenario?

Ready to run this automation?

Copy the project JSON above, open RTILA X, create a new project, and paste it.

This scenario covers 2 RTILA X commands and is referenced in 2 learning articles.

Continue Learning

Was this helpful?