# This file was auto-generated by Fern from our API Definition.

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.response import Response
from ..types.response_dict import ResponseDict
from ..types.response_list import ResponseList
from ..types.response_str import ResponseStr
from .raw_client import AsyncRawBrowserPageClient, RawBrowserPageClient
from .types.navigate_request_wait_until import NavigateRequestWaitUntil
from .types.record_request_action import RecordRequestAction
from .types.type import Type

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class BrowserPageClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawBrowserPageClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawBrowserPageClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawBrowserPageClient
        """
        return self._raw_client

    def navigate(
        self,
        *,
        url: str,
        wait_until: typing.Optional[NavigateRequestWaitUntil] = OMIT,
        timeout: typing.Optional[float] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ResponseDict:
        """
        Navigate the current page to a URL.

        Parameters
        ----------
        url : str

        wait_until : typing.Optional[NavigateRequestWaitUntil]

        timeout : typing.Optional[float]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseDict
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.navigate(
            url="url",
        )
        """
        _response = self._raw_client.navigate(
            url=url, wait_until=wait_until, timeout=timeout, request_options=request_options
        )
        return _response.data

    def back(self, *, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Go back in browser history.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.back()
        """
        _response = self._raw_client.back(request_options=request_options)
        return _response.data

    def forward(self, *, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Go forward in browser history.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.forward()
        """
        _response = self._raw_client.forward(request_options=request_options)
        return _response.data

    def reload(self, *, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Reload the current page.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.reload()
        """
        _response = self._raw_client.reload(request_options=request_options)
        return _response.data

    def click(
        self,
        *,
        selector: typing.Optional[str] = OMIT,
        index: typing.Optional[int] = OMIT,
        x: typing.Optional[float] = OMIT,
        y: typing.Optional[float] = OMIT,
        button: typing.Optional[str] = OMIT,
        click_count: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Click an element by selector, index, or coordinates.

        Parameters
        ----------
        selector : typing.Optional[str]

        index : typing.Optional[int]

        x : typing.Optional[float]

        y : typing.Optional[float]

        button : typing.Optional[str]

        click_count : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.click()
        """
        _response = self._raw_client.click(
            selector=selector,
            index=index,
            x=x,
            y=y,
            button=button,
            click_count=click_count,
            request_options=request_options,
        )
        return _response.data

    def fill(
        self,
        *,
        text: str,
        selector: typing.Optional[str] = OMIT,
        index: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Fill an input field.

        Parameters
        ----------
        text : str

        selector : typing.Optional[str]

        index : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.fill(
            text="text",
        )
        """
        _response = self._raw_client.fill(text=text, selector=selector, index=index, request_options=request_options)
        return _response.data

    def type_text(
        self,
        *,
        text: str,
        delay: typing.Optional[float] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Type text with optional delay between keystrokes.

        Parameters
        ----------
        text : str

        delay : typing.Optional[float]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.type_text(
            text="text",
        )
        """
        _response = self._raw_client.type_text(text=text, delay=delay, request_options=request_options)
        return _response.data

    def press_key(self, *, key: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Press a single key.

        Parameters
        ----------
        key : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.press_key(
            key="key",
        )
        """
        _response = self._raw_client.press_key(key=key, request_options=request_options)
        return _response.data

    def hot_key(
        self, *, keys: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> Response:
        """
        Press a key combination.

        Parameters
        ----------
        keys : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.hot_key(
            keys=["keys"],
        )
        """
        _response = self._raw_client.hot_key(keys=keys, request_options=request_options)
        return _response.data

    def hover(
        self,
        *,
        selector: typing.Optional[str] = OMIT,
        x: typing.Optional[float] = OMIT,
        y: typing.Optional[float] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Hover over an element by selector or coordinates.

        Parameters
        ----------
        selector : typing.Optional[str]

        x : typing.Optional[float]

        y : typing.Optional[float]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.hover()
        """
        _response = self._raw_client.hover(selector=selector, x=x, y=y, request_options=request_options)
        return _response.data

    def select_option(
        self,
        *,
        selector: str,
        value: typing.Optional[str] = OMIT,
        label: typing.Optional[str] = OMIT,
        index: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Select an option in a dropdown.

        Parameters
        ----------
        selector : str

        value : typing.Optional[str]

        label : typing.Optional[str]

        index : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.select_option(
            selector="selector",
        )
        """
        _response = self._raw_client.select_option(
            selector=selector, value=value, label=label, index=index, request_options=request_options
        )
        return _response.data

    def check(self, *, selector: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Check a checkbox.

        Parameters
        ----------
        selector : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.check(
            selector="selector",
        )
        """
        _response = self._raw_client.check(selector=selector, request_options=request_options)
        return _response.data

    def uncheck(self, *, selector: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Uncheck a checkbox.

        Parameters
        ----------
        selector : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.uncheck(
            selector="selector",
        )
        """
        _response = self._raw_client.uncheck(selector=selector, request_options=request_options)
        return _response.data

    def upload_file(
        self, *, selector: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> Response:
        """
        Upload files to a file input element.

        Parameters
        ----------
        selector : str

        files : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.upload_file(
            selector="selector",
            files=["files"],
        )
        """
        _response = self._raw_client.upload_file(selector=selector, files=files, request_options=request_options)
        return _response.data

    def fill_form(
        self,
        *,
        items: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Batch fill multiple form fields.

        Parameters
        ----------
        items : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.fill_form(
            items=[{"key": "value"}],
        )
        """
        _response = self._raw_client.fill_form(items=items, request_options=request_options)
        return _response.data

    def scroll(
        self,
        *,
        direction: typing.Optional[str] = OMIT,
        amount: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Scroll the page in a direction.

        Parameters
        ----------
        direction : typing.Optional[str]

        amount : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.scroll()
        """
        _response = self._raw_client.scroll(direction=direction, amount=amount, request_options=request_options)
        return _response.data

    def scroll_to(
        self,
        *,
        x: typing.Optional[int] = OMIT,
        y: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Scroll to an absolute position.

        Parameters
        ----------
        x : typing.Optional[int]

        y : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.scroll_to()
        """
        _response = self._raw_client.scroll_to(x=x, y=y, request_options=request_options)
        return _response.data

    def scroll_to_element(self, *, selector: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Scroll an element into view.

        Parameters
        ----------
        selector : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.scroll_to_element(
            selector="selector",
        )
        """
        _response = self._raw_client.scroll_to_element(selector=selector, request_options=request_options)
        return _response.data

    def screenshot(
        self,
        *,
        full_page: typing.Optional[bool] = None,
        format: typing.Optional[str] = None,
        quality: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Iterator[bytes]:
        """
        Capture a page screenshot.

        Parameters
        ----------
        full_page : typing.Optional[bool]

        format : typing.Optional[str]

        quality : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.Iterator[bytes]
            Page-level screenshot via Playwright

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.screenshot()
        """
        with self._raw_client.screenshot(
            full_page=full_page, format=format, quality=quality, request_options=request_options
        ) as r:
            yield from r.data

    def record(
        self,
        *,
        action: typing.Optional[RecordRequestAction] = OMIT,
        save_path: typing.Optional[str] = OMIT,
        duration: typing.Optional[float] = OMIT,
        fps: typing.Optional[int] = OMIT,
        quality: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ResponseDict:
        """
        Record page screencast (once/start/pause/resume/stop/status).

        Parameters
        ----------
        action : typing.Optional[RecordRequestAction]

        save_path : typing.Optional[str]

        duration : typing.Optional[float]

        fps : typing.Optional[int]

        quality : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseDict
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.record()
        """
        _response = self._raw_client.record(
            action=action,
            save_path=save_path,
            duration=duration,
            fps=fps,
            quality=quality,
            request_options=request_options,
        )
        return _response.data

    def get_html(
        self, *, outer: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> ResponseStr:
        """
        Get the page HTML content.

        Parameters
        ----------
        outer : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseStr
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.get_html(
            outer=True,
        )
        """
        _response = self._raw_client.get_html(outer=outer, request_options=request_options)
        return _response.data

    def get_text(self, *, request_options: typing.Optional[RequestOptions] = None) -> ResponseStr:
        """
        Get all visible text from the page.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseStr
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.get_text()
        """
        _response = self._raw_client.get_text(request_options=request_options)
        return _response.data

    def get_markdown(self, *, request_options: typing.Optional[RequestOptions] = None) -> ResponseDict:
        """
        Get the page content as Markdown using Readability and Turndown.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseDict
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.get_markdown()
        """
        _response = self._raw_client.get_markdown(request_options=request_options)
        return _response.data

    def get_elements(self, *, request_options: typing.Optional[RequestOptions] = None) -> ResponseList:
        """
        Get all interactive elements on the page.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseList
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.get_elements()
        """
        _response = self._raw_client.get_elements(request_options=request_options)
        return _response.data

    def get_console(
        self, *, clear: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> ResponseList:
        """
        Get captured browser console log messages.

        Parameters
        ----------
        clear : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseList
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.get_console(
            clear=True,
        )
        """
        _response = self._raw_client.get_console(clear=clear, request_options=request_options)
        return _response.data

    def export_console(
        self,
        *,
        save_path: str,
        clear: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Export console logs to a JSON file.

        Parameters
        ----------
        save_path : str

        clear : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.export_console(
            save_path="save_path",
        )
        """
        _response = self._raw_client.export_console(save_path=save_path, clear=clear, request_options=request_options)
        return _response.data

    def evaluate(self, *, expression: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Execute JavaScript and return the result.

        Parameters
        ----------
        expression : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.evaluate(
            expression="expression",
        )
        """
        _response = self._raw_client.evaluate(expression=expression, request_options=request_options)
        return _response.data

    def find_text(self, *, keyword: str, request_options: typing.Optional[RequestOptions] = None) -> ResponseList:
        """
        Find text occurrences on the page.

        Parameters
        ----------
        keyword : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseList
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.find_text(
            keyword="keyword",
        )
        """
        _response = self._raw_client.find_text(keyword=keyword, request_options=request_options)
        return _response.data

    def wait(
        self,
        *,
        type: Type,
        selector: typing.Optional[str] = OMIT,
        state: typing.Optional[str] = OMIT,
        url: typing.Optional[str] = OMIT,
        save_path: typing.Optional[str] = OMIT,
        timeout: typing.Optional[float] = OMIT,
        expression: typing.Optional[str] = OMIT,
        polling: typing.Optional[float] = OMIT,
        url_pattern: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Unified wait: selector, load, url, network_idle, download, function, response, request, or timeout.

        Parameters
        ----------
        type : Type

        selector : typing.Optional[str]

        state : typing.Optional[str]

        url : typing.Optional[str]

        save_path : typing.Optional[str]

        timeout : typing.Optional[float]

        expression : typing.Optional[str]

        polling : typing.Optional[float]

        url_pattern : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        from agent_sandbox import Sandbox

        client = Sandbox(
            base_url="https://yourhost.com/path/to/api",
        )
        client.browser_page.wait(
            type="selector",
        )
        """
        _response = self._raw_client.wait(
            type=type,
            selector=selector,
            state=state,
            url=url,
            save_path=save_path,
            timeout=timeout,
            expression=expression,
            polling=polling,
            url_pattern=url_pattern,
            request_options=request_options,
        )
        return _response.data


class AsyncBrowserPageClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawBrowserPageClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawBrowserPageClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawBrowserPageClient
        """
        return self._raw_client

    async def navigate(
        self,
        *,
        url: str,
        wait_until: typing.Optional[NavigateRequestWaitUntil] = OMIT,
        timeout: typing.Optional[float] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ResponseDict:
        """
        Navigate the current page to a URL.

        Parameters
        ----------
        url : str

        wait_until : typing.Optional[NavigateRequestWaitUntil]

        timeout : typing.Optional[float]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseDict
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.navigate(
                url="url",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.navigate(
            url=url, wait_until=wait_until, timeout=timeout, request_options=request_options
        )
        return _response.data

    async def back(self, *, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Go back in browser history.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.back()


        asyncio.run(main())
        """
        _response = await self._raw_client.back(request_options=request_options)
        return _response.data

    async def forward(self, *, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Go forward in browser history.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.forward()


        asyncio.run(main())
        """
        _response = await self._raw_client.forward(request_options=request_options)
        return _response.data

    async def reload(self, *, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Reload the current page.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.reload()


        asyncio.run(main())
        """
        _response = await self._raw_client.reload(request_options=request_options)
        return _response.data

    async def click(
        self,
        *,
        selector: typing.Optional[str] = OMIT,
        index: typing.Optional[int] = OMIT,
        x: typing.Optional[float] = OMIT,
        y: typing.Optional[float] = OMIT,
        button: typing.Optional[str] = OMIT,
        click_count: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Click an element by selector, index, or coordinates.

        Parameters
        ----------
        selector : typing.Optional[str]

        index : typing.Optional[int]

        x : typing.Optional[float]

        y : typing.Optional[float]

        button : typing.Optional[str]

        click_count : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.click()


        asyncio.run(main())
        """
        _response = await self._raw_client.click(
            selector=selector,
            index=index,
            x=x,
            y=y,
            button=button,
            click_count=click_count,
            request_options=request_options,
        )
        return _response.data

    async def fill(
        self,
        *,
        text: str,
        selector: typing.Optional[str] = OMIT,
        index: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Fill an input field.

        Parameters
        ----------
        text : str

        selector : typing.Optional[str]

        index : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.fill(
                text="text",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.fill(
            text=text, selector=selector, index=index, request_options=request_options
        )
        return _response.data

    async def type_text(
        self,
        *,
        text: str,
        delay: typing.Optional[float] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Type text with optional delay between keystrokes.

        Parameters
        ----------
        text : str

        delay : typing.Optional[float]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.type_text(
                text="text",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.type_text(text=text, delay=delay, request_options=request_options)
        return _response.data

    async def press_key(self, *, key: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Press a single key.

        Parameters
        ----------
        key : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.press_key(
                key="key",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.press_key(key=key, request_options=request_options)
        return _response.data

    async def hot_key(
        self, *, keys: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> Response:
        """
        Press a key combination.

        Parameters
        ----------
        keys : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.hot_key(
                keys=["keys"],
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.hot_key(keys=keys, request_options=request_options)
        return _response.data

    async def hover(
        self,
        *,
        selector: typing.Optional[str] = OMIT,
        x: typing.Optional[float] = OMIT,
        y: typing.Optional[float] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Hover over an element by selector or coordinates.

        Parameters
        ----------
        selector : typing.Optional[str]

        x : typing.Optional[float]

        y : typing.Optional[float]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.hover()


        asyncio.run(main())
        """
        _response = await self._raw_client.hover(selector=selector, x=x, y=y, request_options=request_options)
        return _response.data

    async def select_option(
        self,
        *,
        selector: str,
        value: typing.Optional[str] = OMIT,
        label: typing.Optional[str] = OMIT,
        index: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Select an option in a dropdown.

        Parameters
        ----------
        selector : str

        value : typing.Optional[str]

        label : typing.Optional[str]

        index : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.select_option(
                selector="selector",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.select_option(
            selector=selector, value=value, label=label, index=index, request_options=request_options
        )
        return _response.data

    async def check(self, *, selector: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Check a checkbox.

        Parameters
        ----------
        selector : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.check(
                selector="selector",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.check(selector=selector, request_options=request_options)
        return _response.data

    async def uncheck(self, *, selector: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Uncheck a checkbox.

        Parameters
        ----------
        selector : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.uncheck(
                selector="selector",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.uncheck(selector=selector, request_options=request_options)
        return _response.data

    async def upload_file(
        self, *, selector: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> Response:
        """
        Upload files to a file input element.

        Parameters
        ----------
        selector : str

        files : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.upload_file(
                selector="selector",
                files=["files"],
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.upload_file(selector=selector, files=files, request_options=request_options)
        return _response.data

    async def fill_form(
        self,
        *,
        items: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Batch fill multiple form fields.

        Parameters
        ----------
        items : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.fill_form(
                items=[{"key": "value"}],
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.fill_form(items=items, request_options=request_options)
        return _response.data

    async def scroll(
        self,
        *,
        direction: typing.Optional[str] = OMIT,
        amount: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Scroll the page in a direction.

        Parameters
        ----------
        direction : typing.Optional[str]

        amount : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.scroll()


        asyncio.run(main())
        """
        _response = await self._raw_client.scroll(direction=direction, amount=amount, request_options=request_options)
        return _response.data

    async def scroll_to(
        self,
        *,
        x: typing.Optional[int] = OMIT,
        y: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Scroll to an absolute position.

        Parameters
        ----------
        x : typing.Optional[int]

        y : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.scroll_to()


        asyncio.run(main())
        """
        _response = await self._raw_client.scroll_to(x=x, y=y, request_options=request_options)
        return _response.data

    async def scroll_to_element(
        self, *, selector: str, request_options: typing.Optional[RequestOptions] = None
    ) -> Response:
        """
        Scroll an element into view.

        Parameters
        ----------
        selector : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.scroll_to_element(
                selector="selector",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.scroll_to_element(selector=selector, request_options=request_options)
        return _response.data

    async def screenshot(
        self,
        *,
        full_page: typing.Optional[bool] = None,
        format: typing.Optional[str] = None,
        quality: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.AsyncIterator[bytes]:
        """
        Capture a page screenshot.

        Parameters
        ----------
        full_page : typing.Optional[bool]

        format : typing.Optional[str]

        quality : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.AsyncIterator[bytes]
            Page-level screenshot via Playwright

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.screenshot()


        asyncio.run(main())
        """
        async with self._raw_client.screenshot(
            full_page=full_page, format=format, quality=quality, request_options=request_options
        ) as r:
            async for _chunk in r.data:
                yield _chunk

    async def record(
        self,
        *,
        action: typing.Optional[RecordRequestAction] = OMIT,
        save_path: typing.Optional[str] = OMIT,
        duration: typing.Optional[float] = OMIT,
        fps: typing.Optional[int] = OMIT,
        quality: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ResponseDict:
        """
        Record page screencast (once/start/pause/resume/stop/status).

        Parameters
        ----------
        action : typing.Optional[RecordRequestAction]

        save_path : typing.Optional[str]

        duration : typing.Optional[float]

        fps : typing.Optional[int]

        quality : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseDict
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.record()


        asyncio.run(main())
        """
        _response = await self._raw_client.record(
            action=action,
            save_path=save_path,
            duration=duration,
            fps=fps,
            quality=quality,
            request_options=request_options,
        )
        return _response.data

    async def get_html(
        self, *, outer: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> ResponseStr:
        """
        Get the page HTML content.

        Parameters
        ----------
        outer : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseStr
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.get_html(
                outer=True,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_html(outer=outer, request_options=request_options)
        return _response.data

    async def get_text(self, *, request_options: typing.Optional[RequestOptions] = None) -> ResponseStr:
        """
        Get all visible text from the page.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseStr
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.get_text()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_text(request_options=request_options)
        return _response.data

    async def get_markdown(self, *, request_options: typing.Optional[RequestOptions] = None) -> ResponseDict:
        """
        Get the page content as Markdown using Readability and Turndown.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseDict
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.get_markdown()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_markdown(request_options=request_options)
        return _response.data

    async def get_elements(self, *, request_options: typing.Optional[RequestOptions] = None) -> ResponseList:
        """
        Get all interactive elements on the page.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseList
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.get_elements()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_elements(request_options=request_options)
        return _response.data

    async def get_console(
        self, *, clear: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> ResponseList:
        """
        Get captured browser console log messages.

        Parameters
        ----------
        clear : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseList
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.get_console(
                clear=True,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_console(clear=clear, request_options=request_options)
        return _response.data

    async def export_console(
        self,
        *,
        save_path: str,
        clear: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Export console logs to a JSON file.

        Parameters
        ----------
        save_path : str

        clear : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.export_console(
                save_path="save_path",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.export_console(
            save_path=save_path, clear=clear, request_options=request_options
        )
        return _response.data

    async def evaluate(self, *, expression: str, request_options: typing.Optional[RequestOptions] = None) -> Response:
        """
        Execute JavaScript and return the result.

        Parameters
        ----------
        expression : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.evaluate(
                expression="expression",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.evaluate(expression=expression, request_options=request_options)
        return _response.data

    async def find_text(self, *, keyword: str, request_options: typing.Optional[RequestOptions] = None) -> ResponseList:
        """
        Find text occurrences on the page.

        Parameters
        ----------
        keyword : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ResponseList
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.find_text(
                keyword="keyword",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.find_text(keyword=keyword, request_options=request_options)
        return _response.data

    async def wait(
        self,
        *,
        type: Type,
        selector: typing.Optional[str] = OMIT,
        state: typing.Optional[str] = OMIT,
        url: typing.Optional[str] = OMIT,
        save_path: typing.Optional[str] = OMIT,
        timeout: typing.Optional[float] = OMIT,
        expression: typing.Optional[str] = OMIT,
        polling: typing.Optional[float] = OMIT,
        url_pattern: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Response:
        """
        Unified wait: selector, load, url, network_idle, download, function, response, request, or timeout.

        Parameters
        ----------
        type : Type

        selector : typing.Optional[str]

        state : typing.Optional[str]

        url : typing.Optional[str]

        save_path : typing.Optional[str]

        timeout : typing.Optional[float]

        expression : typing.Optional[str]

        polling : typing.Optional[float]

        url_pattern : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        Response
            Successful Response

        Examples
        --------
        import asyncio

        from agent_sandbox import AsyncSandbox

        client = AsyncSandbox(
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.browser_page.wait(
                type="selector",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.wait(
            type=type,
            selector=selector,
            state=state,
            url=url,
            save_path=save_path,
            timeout=timeout,
            expression=expression,
            polling=polling,
            url_pattern=url_pattern,
            request_options=request_options,
        )
        return _response.data
