pyrit.prompt_target.PlaywrightTarget#

class PlaywrightTarget(*, interaction_func: InteractionFunction, page: None, max_requests_per_minute: int | None = None)[source]#

Bases: PromptTarget

PlaywrightTarget uses Playwright to interact with a web UI.

Parameters:
  • interaction_func (InteractionFunction) – The function that defines how to interact with the page.

  • page (Page) – The Playwright page object to use for interaction.

__init__(*, interaction_func: InteractionFunction, page: None, max_requests_per_minute: int | None = None) None[source]#

Initialize the Playwright target.

Parameters:
  • interaction_func (InteractionFunction) – The function that defines how to interact with the page.

  • page (Page) – The Playwright page object to use for interaction.

  • max_requests_per_minute (int, Optional) – Number of requests the target can handle per minute before hitting a rate limit. The number of requests sent to the target will be capped at the value provided.

Methods

__init__(*, interaction_func, page[, ...])

Initialize the Playwright target.

dispose_db_engine()

Dispose database engine to release database connections and resources.

get_identifier()

send_prompt_async(**kwargs)

Sends a normalized prompt async to the prompt target.

set_model_name(*, model_name)

Set the model name for this target.

Attributes

async send_prompt_async(**kwargs)#

Sends a normalized prompt async to the prompt target.

supported_converters: list#