"""
RelativeLocator 相对定位器类型存根

提供 VSCode/Pylance 类型提示支持。
"""
from typing import Optional, TYPE_CHECKING
from playwright.async_api import Locator, Page

if TYPE_CHECKING:
    from .element import Element


class RelativeLocator:
    """相对定位器"""

    def __init__(self, locator: Locator, page: Page) -> None: ...

    def parent(self, level: int = 1) -> "Element": ...
    def child(
        self,
        selector: Optional[str] = None,
        index: int = 0,
    ) -> "Element": ...
    def children(self, selector: Optional[str] = None) -> "Element": ...
    def sibling(
        self,
        selector: Optional[str] = None,
        direction: str = "next",
    ) -> "Element": ...
    def next_sibling(self, selector: Optional[str] = None) -> "Element": ...
    def prev_sibling(self, selector: Optional[str] = None) -> "Element": ...
    def next_siblings(self, selector: Optional[str] = None) -> "Element": ...
    def prev_siblings(self, selector: Optional[str] = None) -> "Element": ...
    def ancestor(self, selector: str) -> "Element": ...
    def descendant(self, selector: str) -> "Element": ...
    async def near(
        self,
        selector: str,
        max_distance: int = 50,
    ) -> Optional["Element"]: ...
    def following(self, selector: Optional[str] = None) -> "Element": ...
    def preceding(self, selector: Optional[str] = None) -> "Element": ...
