# `Fluffy.Locator`
[🔗](https://github.com/ftes/fluffy/blob/v0.8.0/lib/fluffy/locator.ex#L1)

A lazy, driver-independent element query.

Role locators accept these options:

* `:name` (`t:String.t/0`) - Restrict the role locator by accessible name.

* `:exact` (`t:boolean/0`) - Require an exact, case-sensitive accessible-name match.

Text, label, placeholder, alternative-text, and title locators accept:

* `:exact` (`t:boolean/0`) - Require an exact, case-sensitive match.

Test-id locators accept:

* `:attribute` (`t:String.t/0`) - Attribute used as the test-id source. The default value is `"data-testid"`.

`filter/2` accepts:

* `:visible` (`t:boolean/0`) - Filter by structural visibility in Static/Live and rendered visibility in Playwright.

* `:exact` (`t:boolean/0`) - Match the whole normalized text, case-sensitively, for has_text and has_not_text.

* `:has` (struct of type `Fluffy.Locator`) - Keep elements containing a match for this locator.

* `:has_text` (`t:String.t/0`) - Keep elements containing this normalized text.

* `:has_not` (struct of type `Fluffy.Locator`) - Keep elements containing no match for this locator.

* `:has_not_text` (`t:String.t/0`) - Keep elements that do not contain this normalized text.

# `exact_option`

```elixir
@type exact_option() :: {:exact, boolean()}
```

# `filter_option`

```elixir
@type filter_option() ::
  {:visible, boolean()}
  | {:exact, boolean()}
  | {:has, t()}
  | {:has_text, binary()}
  | {:has_not, t()}
  | {:has_not_text, binary()}
```

# `role_option`

```elixir
@type role_option() :: {:name, binary()} | {:exact, boolean()}
```

# `scope`

```elixir
@type scope() :: t() | Fluffy.FrameLocator.t()
```

# `t`

```elixir
@type t() :: %Fluffy.Locator{operations: [term()]}
```

# `test_id_option`

```elixir
@type test_id_option() :: {:attribute, binary()}
```

# `and_`

```elixir
@spec and_(t(), t()) :: t()
```

Matches only elements matched by both locators, preserving the left locator's order.

The right locator resolves from the same query root, not within each left match.
Inside `filter/2`'s `:has` or `:has_not`, that root is the filter candidate.

    by_css("#email") |> and_(by_label("Email", exact: true))

With Playwright, the right locator may be relative to the left locator's frame
or use the same frame prefix. Playwright validates frame compatibility when
the locator resolves; intersections across different frames are unsupported.

    frame = frame_locator("#checkout")
    by_css(frame, "input") |> and_(by_label(frame, "Email"))

Like other locators, intersections are lazy and retain normal action strictness.

# `append`

# `by_alt_text`

```elixir
@spec by_alt_text(String.t(), [exact_option()]) :: t()
@spec by_alt_text(scope(), String.t()) :: t()
```

# `by_alt_text`

```elixir
@spec by_alt_text(scope(), String.t(), [exact_option()]) :: t()
```

# `by_css`

```elixir
@spec by_css(String.t()) :: t()
```

# `by_css`

```elixir
@spec by_css(scope(), String.t()) :: t()
```

# `by_label`

```elixir
@spec by_label(String.t(), [exact_option()]) :: t()
@spec by_label(scope(), String.t()) :: t()
```

# `by_label`

```elixir
@spec by_label(scope(), String.t(), [exact_option()]) :: t()
```

# `by_placeholder`

```elixir
@spec by_placeholder(String.t(), [exact_option()]) :: t()
@spec by_placeholder(scope(), String.t()) :: t()
```

# `by_placeholder`

```elixir
@spec by_placeholder(scope(), String.t(), [exact_option()]) :: t()
```

# `by_role`

```elixir
@spec by_role(atom(), [role_option()]) :: t()
@spec by_role(scope(), atom()) :: t()
```

# `by_role`

```elixir
@spec by_role(scope(), atom(), [role_option()]) :: t()
```

# `by_test_id`

```elixir
@spec by_test_id(String.t(), [test_id_option()]) :: t()
@spec by_test_id(scope(), String.t()) :: t()
```

# `by_test_id`

```elixir
@spec by_test_id(scope(), String.t(), [test_id_option()]) :: t()
```

# `by_text`

```elixir
@spec by_text(String.t(), [exact_option()]) :: t()
@spec by_text(scope(), String.t()) :: t()
```

# `by_text`

```elixir
@spec by_text(scope(), String.t(), [exact_option()]) :: t()
```

# `by_title`

```elixir
@spec by_title(String.t(), [exact_option()]) :: t()
@spec by_title(scope(), String.t()) :: t()
```

# `by_title`

```elixir
@spec by_title(scope(), String.t(), [exact_option()]) :: t()
```

# `content_frame`
*Playwright only* 

```elixir
@spec content_frame(t()) :: Fluffy.FrameLocator.t()
```

Converts an iframe element query to a lazy query of its content frame.

# `describe`

# `filter`

```elixir
@spec filter(t(), [filter_option()]) :: t()
```

# `first`

# `frame_locator`
*Playwright only* 

```elixir
@spec frame_locator(String.t()) :: Fluffy.FrameLocator.t()
```

Creates a lazy frame scope. Frame traversal requires the Playwright driver.

# `frame_locator`
*Playwright only* 

```elixir
@spec frame_locator(scope(), String.t()) :: Fluffy.FrameLocator.t()
```

Creates a nested frame scope relative to an element or frame query.

# `last`

# `new`

# `nth`

# `or_`

```elixir
@spec or_(t(), t()) :: t()
```

Matches elements in either locator, once each in document order, retaining action strictness.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
