{
  "format": 3,
  "id": "2.2",
  "title": "A locator stores the recipe, engines find the elements",
  "layers": {
    "client": {
      "label": "Client"
    },
    "page": {
      "label": "Page"
    },
    "server": {
      "label": "Server"
    }
  },
  "lanes": {
    "test": {
      "label": "YOUR TEST",
      "layer": "client",
      "y": 6,
      "h": 226
    },
    "page": {
      "label": "IN THE PAGE · SELECTOR ENGINES",
      "layer": "page",
      "y": 258,
      "h": 390
    },
    "server": {
      "label": "PLAYWRIGHT SERVER",
      "layer": "server",
      "y": 674,
      "h": 164
    },
    "child": {
      "label": "CHILD DOCUMENT",
      "layer": "page",
      "y": 862,
      "h": 80
    }
  },
  "frames": {},
  "nodes": {
    "frame": {
      "label": "locator",
      "layer": "client",
      "lane": "test",
      "mono": false,
      "box": [
        24,
        28,
        228,
        38
      ]
    },
    "parts": {
      "label": "selector parts",
      "layer": "client",
      "lane": "test",
      "mono": false,
      "box": [
        24,
        104,
        228,
        38
      ]
    },
    "call": {
      "label": "locator.click()",
      "layer": "client",
      "lane": "test",
      "mono": true,
      "box": [
        24,
        180,
        228,
        38
      ]
    },
    "role": {
      "label": "role=listitem",
      "layer": "page",
      "lane": "page",
      "mono": true,
      "box": [
        24,
        292,
        228,
        38
      ]
    },
    "text": {
      "label": "has-text=\"Product\"i",
      "layer": "page",
      "lane": "page",
      "mono": true,
      "box": [
        24,
        368,
        228,
        38
      ]
    },
    "nth": {
      "label": "nth=0",
      "layer": "page",
      "lane": "page",
      "mono": true,
      "box": [
        24,
        444,
        228,
        38
      ]
    },
    "has": {
      "label": "has · inner search",
      "layer": "page",
      "lane": "page",
      "mono": false,
      "box": [
        24,
        520,
        228,
        38
      ]
    },
    "button": {
      "label": "role=button",
      "layer": "page",
      "lane": "page",
      "mono": true,
      "box": [
        24,
        596,
        228,
        38
      ]
    },
    "iframe": {
      "label": "iframe#checkout",
      "layer": "server",
      "lane": "server",
      "mono": false,
      "box": [
        24,
        708,
        228,
        38
      ]
    },
    "content": {
      "label": "content frame",
      "layer": "server",
      "lane": "server",
      "mono": false,
      "box": [
        24,
        784,
        228,
        38
      ]
    },
    "pay": {
      "label": "role=button",
      "layer": "page",
      "lane": "child",
      "mono": true,
      "box": [
        24,
        896,
        228,
        38
      ]
    }
  },
  "edges": {
    "stores": {
      "from": "frame",
      "to": "parts",
      "label": {
        "at": [
          150,
          89
        ],
        "text": "stores"
      },
      "path": "M138,66 V102",
      "badge": [
        138,
        85
      ]
    },
    "sends": {
      "from": "call",
      "to": "parts",
      "label": {
        "at": [
          150,
          165
        ],
        "text": "sends"
      },
      "path": "M138,180 V144",
      "badge": [
        138,
        161
      ]
    },
    "runs": {
      "from": "call",
      "to": "role",
      "label": {
        "at": [
          360,
          236
        ],
        "text": "runs"
      },
      "path": "M252,199 H350 V311 H254",
      "badge": [
        350,
        255
      ]
    },
    "filter": {
      "from": "role",
      "to": "text",
      "label": {
        "at": [
          150,
          353
        ],
        "text": "hasText"
      },
      "path": "M138,330 V366",
      "badge": [
        138,
        349
      ]
    },
    "first": {
      "from": "text",
      "to": "nth",
      "label": {
        "at": [
          150,
          429
        ],
        "text": "first()"
      },
      "path": "M138,406 V442",
      "badge": [
        138,
        425
      ]
    },
    "inner": {
      "from": "role",
      "to": "has",
      "label": {
        "at": [
          271,
          518
        ],
        "text": "inner search"
      },
      "path": "M252,311 H382 V539 H254",
      "badge": [
        382,
        484
      ]
    },
    "inside": {
      "from": "has",
      "to": "button",
      "label": {
        "at": [
          150,
          581
        ],
        "text": "search inside"
      },
      "path": "M138,558 V594",
      "badge": [
        138,
        577
      ]
    },
    "find": {
      "from": "call",
      "to": "iframe",
      "label": {
        "at": [
          270,
          706
        ],
        "text": "finds iframe"
      },
      "path": "M252,199 H408 V727 H254",
      "badge": [
        408,
        663
      ]
    },
    "enter": {
      "from": "iframe",
      "to": "content",
      "label": {
        "at": [
          150,
          769
        ],
        "text": "content frame"
      },
      "path": "M138,746 V782",
      "badge": [
        138,
        765
      ]
    },
    "rest": {
      "from": "content",
      "to": "pay",
      "label": {
        "at": [
          256,
          793
        ],
        "text": "remaining parts"
      },
      "path": "M252,803 H350 V915 H254",
      "badge": [
        350,
        859
      ]
    }
  },
  "scenarios": [
    {
      "id": "how",
      "label": "How a recipe runs",
      "display": {
        "counterLabel": false,
        "edges": "progressive",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "steps": [
        {
          "id": "a-locator-stores-a-frame-and-a-s",
          "title": "A locator stores a frame and a selector string",
          "text": "Building this recipe does not select an element.",
          "show": [
            "frame"
          ],
          "current": [
            "frame"
          ],
          "edges": [],
          "defs": [
            "frame"
          ],
          "sources": [
            {
              "label": "locator.ts:50-57",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L50-L57"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "chaining-adds-parts-to-the-strin",
          "title": "Chaining adds parts to the string",
          "text": "getByRole adds an internal role selector; getByText adds an internal text selector.",
          "show": [
            "parts"
          ],
          "current": [
            "parts"
          ],
          "edges": [
            "stores"
          ],
          "defs": [
            "parts"
          ],
          "sources": [
            {
              "label": "locator.ts:183-189",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L183-L189"
            },
            {
              "label": "locator.ts:219-221",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L219-L221"
            },
            {
              "label": "locatorUtils.ts:83-89",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorUtils.ts#L83-L89"
            },
            {
              "label": "locatorUtils.ts:65-67",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorUtils.ts#L65-L67"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "click-sends-the-stored-recipe",
          "title": "click() sends the stored recipe",
          "text": "When a click needs elements, the server runs the parsed selector inside the page.",
          "show": [
            "call"
          ],
          "current": [
            "call"
          ],
          "edges": [
            "sends"
          ],
          "defs": [],
          "sources": [
            {
              "label": "locator.ts:122-124",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L122-L124"
            },
            {
              "label": "frameSelectors.ts:242-251",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L242-L251"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "each-part-uses-a-selector-engine",
          "title": "Each part uses a selector engine",
          "text": "Matches from one part become search roots for the next.",
          "show": [
            "role"
          ],
          "current": [
            "role"
          ],
          "edges": [
            "runs"
          ],
          "defs": [
            "role"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "injectedScript.ts:433-439",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L433-L439"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "filters-and-indexes-narrow-the-m",
          "title": "Filters and indexes narrow the matches",
          "text": "The text filter keeps the two items with “Product”. nth=0 takes the first of them.",
          "show": [
            "text",
            "nth"
          ],
          "current": [
            "text",
            "nth"
          ],
          "edges": [
            "filter",
            "first"
          ],
          "defs": [
            "text",
            "nth"
          ],
          "sources": [
            {
              "label": "locator.ts:59-63",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L59-L63"
            },
            {
              "label": "injectedScript.ts:215-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L215-L243"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "locator.ts:255-265",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L255-L265"
            },
            {
              "label": "injectedScript.ts:297-303",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L297-L303"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "has-runs-its-inner-search-inside",
          "title": "has runs its inner search inside each candidate",
          "text": "A has condition carries an inner selector. The inner locator must belong to the same frame.",
          "show": [
            "has"
          ],
          "current": [
            "has"
          ],
          "edges": [
            "inner"
          ],
          "defs": [
            "has"
          ],
          "code": "has",
          "sources": [
            {
              "label": "locator.ts:65-70",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L65-L70"
            },
            {
              "label": "injectedScript.ts:587-595",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L587-L595"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "the-next-part-searches-inside-th",
          "title": "The next part searches inside the item",
          "text": "Start the inner recipe at its text; the last part searches inside that item: its button.",
          "show": [
            "button"
          ],
          "current": [
            "button"
          ],
          "edges": [
            "inside"
          ],
          "defs": [
            "button"
          ],
          "code": "example",
          "sources": [
            {
              "label": "locatorUtils.ts:65-67",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorUtils.ts#L65-L67"
            },
            {
              "label": "injectedScript.ts:587-595",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L587-L595"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "injectedScript.ts:433-439",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L433-L439"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "enter-frame-splits-the-recipe",
          "title": "enter-frame splits the recipe",
          "text": "The server finds the iframe, gets its content frame, then runs the remaining parts in that frame.",
          "show": [
            "iframe",
            "content",
            "pay"
          ],
          "current": [
            "iframe",
            "content",
            "pay"
          ],
          "edges": [
            "find",
            "enter",
            "rest"
          ],
          "defs": [
            "iframe"
          ],
          "sources": [
            {
              "label": "locator.ts:454-467",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L454-L467"
            },
            {
              "label": "selectorParser.ts:126-137",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/selectorParser.ts#L126-L137"
            },
            {
              "label": "frameSelectors.ts:211-230",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L211-L230"
            },
            {
              "label": "frameSelectors.ts:190-197",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L190-L197"
            },
            {
              "label": "frameSelectors.ts:242-251",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L242-L251"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        }
      ]
    },
    {
      "id": "chain",
      "label": "Chain",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "steps": [
        {
          "id": "a-locator-starts-with-a-frame-th",
          "title": "A locator starts with a frame: the main page.",
          "text": "A locator starts with a frame: the main page.",
          "show": [
            "frame"
          ],
          "current": [
            "frame"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "locator.ts:50-57",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L50-L57"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "getbyrole-listitem-adds-a-part-n",
          "title": "getByRole('listitem') adds a part. No element is found yet.",
          "text": "getByRole('listitem') adds a part. No element is found yet.",
          "show": [
            "parts"
          ],
          "current": [
            "parts"
          ],
          "edges": [
            "stores"
          ],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "locator.ts:219-221",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L219-L221"
            },
            {
              "label": "locatorUtils.ts:83-89",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorUtils.ts#L83-L89"
            },
            {
              "label": "locator.ts:183-189",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L183-L189"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "filter-hastext-product-adds-a-fi",
          "title": "filter({ hasText: 'Product' }) adds a filter part.",
          "text": "filter({ hasText: 'Product' }) adds a filter part.",
          "show": [
            "parts"
          ],
          "current": [
            "parts"
          ],
          "edges": [
            "stores"
          ],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "locator.ts:227-229",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L227-L229"
            },
            {
              "label": "locator.ts:59-63",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L59-L63"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "first-adds-nth-0-still-no-search",
          "title": "first() adds nth=0. Still no search in the page.",
          "text": "first() adds nth=0. Still no search in the page.",
          "show": [
            "parts"
          ],
          "current": [
            "parts"
          ],
          "edges": [
            "stores"
          ],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "locator.ts:255-265",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L255-L265"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "click-sends-the-recipe-the-call",
          "title": "click() sends the recipe. The call log prints it back as code.",
          "text": "click() sends the recipe. The call log prints it back as code.",
          "show": [
            "call"
          ],
          "current": [
            "call"
          ],
          "edges": [
            "sends"
          ],
          "defs": [],
          "log": [
            "waiting for getByRole('listitem').filter({ hasText: 'Product' }).first()"
          ],
          "sources": [
            {
              "label": "locator.ts:122-124",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L122-L124"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "the-role-engine-finds-three-list",
          "title": "The role engine finds three list items.",
          "text": "The role engine finds three list items.",
          "show": [
            "role"
          ],
          "current": [
            "role"
          ],
          "edges": [
            "runs"
          ],
          "defs": [],
          "log": [
            "waiting for getByRole('listitem').filter({ hasText: 'Product' }).first()"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:215-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L215-L243"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "injectedScript.ts:433-439",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L433-L439"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "the-text-filter-keeps-the-two-it",
          "title": "The text filter keeps the two items with “Product”.",
          "text": "The text filter keeps the two items with “Product”.",
          "show": [
            "text"
          ],
          "current": [
            "text"
          ],
          "edges": [
            "filter"
          ],
          "defs": [],
          "log": [
            "waiting for getByRole('listitem').filter({ hasText: 'Product' }).first()"
          ],
          "sources": [
            {
              "label": "locator.ts:59-63",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L59-L63"
            },
            {
              "label": "injectedScript.ts:215-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L215-L243"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "nth-0-takes-the-first-of-them",
          "title": "nth=0 takes the first of them.",
          "text": "nth=0 takes the first of them.",
          "show": [
            "nth"
          ],
          "current": [
            "nth"
          ],
          "edges": [
            "first"
          ],
          "defs": [],
          "log": [
            "waiting for getByRole('listitem').filter({ hasText: 'Product' }).first()"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:297-303",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L297-L303"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "frame",
          "step": "a-locator-starts-with-a-frame-th",
          "log": []
        },
        {
          "node": "parts",
          "step": "getbyrole-listitem-adds-a-part-n",
          "log": [],
          "edge": "stores"
        },
        {
          "node": "parts",
          "step": "filter-hastext-product-adds-a-fi",
          "log": [],
          "edge": "stores"
        },
        {
          "node": "parts",
          "step": "first-adds-nth-0-still-no-search",
          "log": [],
          "edge": "stores"
        },
        {
          "node": "parts",
          "step": "click-sends-the-recipe-the-call",
          "log": [
            "waiting for getByRole('listitem').filter({ hasText: 'Product' }).first()"
          ],
          "edge": "sends"
        },
        {
          "node": "role",
          "step": "the-role-engine-finds-three-list",
          "log": [],
          "edge": "runs"
        },
        {
          "node": "text",
          "step": "the-text-filter-keeps-the-two-it",
          "log": [],
          "edge": "filter"
        },
        {
          "node": "nth",
          "step": "nth-0-takes-the-first-of-them",
          "log": [],
          "edge": "first"
        }
      ]
    },
    {
      "id": "inner",
      "label": "Inner search",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "steps": [
        {
          "id": "the-inner-recipe-was-built-from",
          "title": "The inner recipe was built from rows: it starts with list items.",
          "text": "The inner recipe was built from rows: it starts with list items.",
          "show": [
            "parts"
          ],
          "current": [
            "parts"
          ],
          "edges": [
            "stores"
          ],
          "defs": [],
          "code": "example",
          "log": [],
          "sources": [
            {
              "label": "locator.ts:183-189",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L183-L189"
            },
            {
              "label": "locator.ts:65-70",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L65-L70"
            },
            {
              "label": "locator.ts:219-221",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L219-L221"
            },
            {
              "label": "locatorUtils.ts:65-67",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorUtils.ts#L65-L67"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "three-list-items-are-the-candida",
          "title": "Three list items are the candidates.",
          "text": "Three list items are the candidates.",
          "show": [
            "role"
          ],
          "current": [
            "role"
          ],
          "edges": [
            "runs"
          ],
          "defs": [],
          "code": "example",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByRole('listitem').getByText('Product 2') }).getByRole('button')"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:215-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L215-L243"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "injectedScript.ts:433-439",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L433-L439"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "inside-each-item-it-looks-for-an",
          "title": "Inside each item, it looks for another list item. There is none.",
          "text": "Inside each item, it looks for another list item. There is none.",
          "show": [
            "has"
          ],
          "current": [
            "has"
          ],
          "edges": [
            "inner"
          ],
          "defs": [],
          "code": "example",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByRole('listitem').getByText('Product 2') }).getByRole('button')"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:587-595",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L587-L595"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "start-the-inner-recipe-at-its-te",
          "title": "Start the inner recipe at its text: page.getByText('Product 2').",
          "text": "Start the inner recipe at its text: page.getByText('Product 2').",
          "show": [
            "has"
          ],
          "current": [
            "has"
          ],
          "edges": [
            "inner"
          ],
          "defs": [],
          "code": "example",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByText('Product 2') }).getByRole('button')"
          ],
          "sources": [
            {
              "label": "locatorUtils.ts:65-67",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorUtils.ts#L65-L67"
            },
            {
              "label": "locator.ts:183-189",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L183-L189"
            },
            {
              "label": "locator.ts:65-70",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L65-L70"
            },
            {
              "label": "injectedScript.ts:587-595",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L587-L595"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "three-list-items-again",
          "title": "Three list items again.",
          "text": "Three list items again.",
          "show": [
            "role"
          ],
          "current": [
            "role"
          ],
          "edges": [
            "runs"
          ],
          "defs": [],
          "code": "example",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByText('Product 2') }).getByRole('button')"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:215-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L215-L243"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "injectedScript.ts:433-439",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L433-L439"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "only-one-item-has-product-2-insi",
          "title": "Only one item has “Product 2” inside it.",
          "text": "Only one item has “Product 2” inside it.",
          "show": [
            "has"
          ],
          "current": [
            "has"
          ],
          "edges": [
            "inner"
          ],
          "defs": [],
          "code": "example",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByText('Product 2') }).getByRole('button')"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:587-595",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L587-L595"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "the-last-part-searches-inside-th",
          "title": "The last part searches inside that item: its button.",
          "text": "The last part searches inside that item: its button.",
          "show": [
            "button"
          ],
          "current": [
            "button"
          ],
          "edges": [
            "inside"
          ],
          "defs": [],
          "code": "example",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByText('Product 2') }).getByRole('button')"
          ],
          "sources": [
            {
              "label": "injectedScript.ts:587-595",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L587-L595"
            },
            {
              "label": "injectedScript.ts:403-427",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
            },
            {
              "label": "injectedScript.ts:433-439",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L433-L439"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "parts",
          "step": "the-inner-recipe-was-built-from",
          "log": [],
          "edge": "stores"
        },
        {
          "node": "role",
          "step": "three-list-items-are-the-candida",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByRole('listitem').getByText('Product 2') }).getByRole('button')"
          ],
          "edge": "runs"
        },
        {
          "node": "has",
          "step": "inside-each-item-it-looks-for-an",
          "log": [],
          "edge": "inner",
          "fail": true
        },
        {
          "node": "has",
          "step": "start-the-inner-recipe-at-its-te",
          "log": [
            "waiting for getByRole('listitem').filter({ has: getByText('Product 2') }).getByRole('button')"
          ],
          "edge": "inner"
        },
        {
          "node": "role",
          "step": "three-list-items-again",
          "log": [],
          "edge": "runs"
        },
        {
          "node": "has",
          "step": "only-one-item-has-product-2-insi",
          "log": [],
          "edge": "inner"
        },
        {
          "node": "button",
          "step": "the-last-part-searches-inside-th",
          "log": [],
          "edge": "inside"
        }
      ]
    },
    {
      "id": "iframe",
      "label": "Iframe",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "steps": [
        {
          "id": "framelocator-checkout-adds-an-en",
          "title": "frameLocator('#checkout') adds an enter-frame part.",
          "text": "frameLocator('#checkout') adds an enter-frame part.",
          "show": [
            "parts"
          ],
          "current": [
            "parts"
          ],
          "edges": [
            "stores"
          ],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "locator.ts:223-225",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L223-L225"
            },
            {
              "label": "locator.ts:454-467",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L454-L467"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "the-part-before-enter-frame-runs",
          "title": "The part before enter-frame runs in the main page: the iframe.",
          "text": "The part before enter-frame runs in the main page: the iframe.",
          "show": [
            "iframe"
          ],
          "current": [
            "iframe"
          ],
          "edges": [
            "find"
          ],
          "defs": [],
          "log": [
            "waiting for locator('#checkout').contentFrame().getByRole('button')"
          ],
          "sources": [
            {
              "label": "selectorParser.ts:126-137",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/selectorParser.ts#L126-L137"
            },
            {
              "label": "frameSelectors.ts:211-230",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L211-L230"
            },
            {
              "label": "frameSelectors.ts:190-197",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L190-L197"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "the-server-takes-the-iframe-s-co",
          "title": "The server takes the iframe's content frame.",
          "text": "The server takes the iframe's content frame.",
          "show": [
            "content"
          ],
          "current": [
            "content"
          ],
          "edges": [
            "enter"
          ],
          "defs": [],
          "log": [
            "waiting for locator('#checkout').contentFrame().getByRole('button')"
          ],
          "sources": [
            {
              "label": "frameSelectors.ts:190-197",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L190-L197"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        },
        {
          "id": "the-rest-of-the-recipe-runs-in-t",
          "title": "The rest of the recipe runs in the child document.",
          "text": "The rest of the recipe runs in the child document.",
          "show": [
            "pay"
          ],
          "current": [
            "pay"
          ],
          "edges": [
            "rest"
          ],
          "defs": [],
          "log": [
            "waiting for locator('#checkout').contentFrame().getByRole('button')"
          ],
          "sources": [
            {
              "label": "frameSelectors.ts:211-230",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L211-L230"
            },
            {
              "label": "frameSelectors.ts:242-251",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L242-L251"
            },
            {
              "label": "frames.ts:1200",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frames.ts#L1200"
            },
            {
              "label": "locatorGenerators.ts:320-358",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/isomorphic/locatorGenerators.ts#L320-L358"
            }
          ],
          "deeper": [
            {
              "title": "2.1 Two loops behind every click",
              "href": "/2-actions/2-1-two-loops/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "parts",
          "step": "framelocator-checkout-adds-an-en",
          "log": [],
          "edge": "stores"
        },
        {
          "node": "iframe",
          "step": "the-part-before-enter-frame-runs",
          "log": [
            "waiting for locator('#checkout').contentFrame().getByRole('button')"
          ],
          "edge": "find"
        },
        {
          "node": "content",
          "step": "the-server-takes-the-iframe-s-co",
          "log": [],
          "edge": "enter"
        },
        {
          "node": "pay",
          "step": "the-rest-of-the-recipe-runs-in-t",
          "log": [],
          "edge": "rest"
        }
      ]
    }
  ],
  "definitions": {
    "frame": {
      "term": "Locator",
      "text": "A locator stores a frame and a selector string."
    },
    "parts": {
      "term": "Selector parts",
      "text": "Chaining adds parts to the stored selector string; building it does not select an element."
    },
    "role": {
      "term": "Selector engine",
      "text": "Each part uses a selector engine; matches become search roots for the next part."
    },
    "text": {
      "term": "Text filter",
      "text": "The text filter keeps the two items with “Product”."
    },
    "nth": {
      "term": "nth=0",
      "text": "nth=0 takes the first match."
    },
    "has": {
      "term": "has filter",
      "text": "A candidate stays only when its inner search matches inside it."
    },
    "button": {
      "term": "Inner roots",
      "text": "The last part searches inside that item: its button."
    },
    "iframe": {
      "term": "Frame split",
      "text": "The server finds the iframe, gets its content frame, then runs the remaining parts there."
    }
  },
  "code": {
    "has": {
      "title": "Inside Playwright · locator.ts",
      "source": {
        "label": "locator.ts:65-70",
        "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L65-L70"
      },
      "lines": [
        "if (options?.has) {",
        "  const locator = options.has;",
        "  if (locator._frame !== frame)",
        "    throw new Error(`Inner \"has\" locator must belong to the same frame.`);",
        "  this._selector += ` >> internal:has=` + JSON.stringify(locator._selector);",
        "}"
      ]
    },
    "example": {
      "title": "In your test · an inner search",
      "lines": [
        "const rows = page.getByRole('listitem');",
        "// ✗ This searches for rows inside rows",
        "const wrong = rows.filter({",
        "  has: rows.getByText('Product 2'),",
        "});",
        "// ✓ Start the inner recipe at its text",
        "const item = rows.filter({",
        "  has: page.getByText('Product 2'),",
        "});",
        "await item.getByRole('button').click();"
      ]
    }
  },
  "conceptScenario": "how",
  "concepts": [
    {
      "label": "Stored recipe",
      "layer": "client",
      "items": [
        {
          "definition": "frame",
          "short": "A locator stores a frame and a selector string.",
          "nodes": [
            "frame"
          ],
          "step": {
            "step": "a-locator-stores-a-frame-and-a-s"
          },
          "source": {
            "label": "locator.ts:50-57",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L50-L57"
          }
        },
        {
          "definition": "parts",
          "short": "Chaining adds parts to the stored selector string; building it does not select an element.",
          "nodes": [
            "parts"
          ],
          "step": {
            "step": "chaining-adds-parts-to-the-strin"
          },
          "source": {
            "label": "locator.ts:183-189",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/locator.ts#L183-L189"
          }
        }
      ]
    },
    {
      "label": "In the page",
      "layer": "page",
      "items": [
        {
          "definition": "role",
          "short": "Each part uses a selector engine; matches become search roots for the next part.",
          "nodes": [
            "role"
          ],
          "step": {
            "step": "each-part-uses-a-selector-engine"
          },
          "source": {
            "label": "injectedScript.ts:403-427",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
          }
        },
        {
          "definition": "nth",
          "short": "nth=0 takes the first match.",
          "nodes": [
            "nth"
          ],
          "step": {
            "step": "filters-and-indexes-narrow-the-m"
          },
          "source": {
            "label": "injectedScript.ts:297-303",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L297-L303"
          }
        },
        {
          "definition": "has",
          "short": "A candidate stays only when its inner search matches inside it.",
          "nodes": [
            "has"
          ],
          "step": {
            "step": "has-runs-its-inner-search-inside"
          },
          "source": {
            "label": "injectedScript.ts:587-595",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L587-L595"
          }
        },
        {
          "definition": "button",
          "short": "The last part searches inside that item: its button.",
          "nodes": [
            "button"
          ],
          "step": {
            "step": "the-next-part-searches-inside-th"
          },
          "source": {
            "label": "injectedScript.ts:403-427",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/injected/src/injectedScript.ts#L403-L427"
          }
        }
      ]
    },
    {
      "label": "Frame resolution",
      "layer": "server",
      "items": [
        {
          "definition": "iframe",
          "short": "The server resolves each frame chunk before the last selector chunk.",
          "nodes": [
            "iframe",
            "content",
            "pay"
          ],
          "step": {
            "step": "enter-frame-splits-the-recipe"
          },
          "source": {
            "label": "frameSelectors.ts:211-230",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/frameSelectors.ts#L211-L230"
          }
        }
      ]
    }
  ],
  "callouts": {
    "1": [
      "frame",
      "parts"
    ],
    "2": [
      "parts",
      "nth",
      "has"
    ],
    "3": [
      "role",
      "text",
      "has",
      "button"
    ],
    "4": [
      "iframe",
      "content",
      "pay"
    ]
  },
  "deeper": [
    {
      "title": "2.1 Two loops behind every click",
      "href": "/2-actions/2-1-two-loops/",
      "why": "How a click resolves the locator and retries."
    },
    {
      "title": "2.3 Stable is a count of equal boxes",
      "href": "/2-actions/2-3-stable-is-measured/",
      "why": "How Playwright checks the element after resolution."
    },
    {
      "title": "2.4 A click checks what is under its point",
      "href": "/2-actions/2-4-who-gets-the-click/",
      "why": "How Playwright checks the click point."
    }
  ],
  "viewBox": [
    420,
    950
  ]
}
