text: import pytest
  
  from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
  from tests.support.inline import inline
  
  
  def element_send_keys(session, element, text):
      return session.transport.send(
          "POST", "/session/{session_id}/element/{element_id}/value".format(
              session_id=session.session_id,
              element_id=element.id),
          {"text": text})
  
  
  @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
  @pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
  def test_handle_prompt_accept(session, create_dialog, dialog_type):
      session.url = inline("<input>")
      element = session.find.css("input", all=False)
  
      create_dialog(dialog_type, text="dialog")
  
      response = element_send_keys(session, element, "foo")
      assert_success(response)
  
      assert_dialog_handled(session, expected_text="dialog")
  
  
  def test_handle_prompt_accept_and_notify():
      """TODO"""
  
  
  def test_handle_prompt_dismiss():
      """TODO"""
  
  
  def test_handle_prompt_dismiss_and_notify():
      """TODO"""
  
  
  def test_handle_prompt_ignore():
      """TODO"""
  
  
  @pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
  def test_handle_prompt_default(session, create_dialog, dialog_type):
      session.url = inline("<input>")
      element = session.find.css("input", all=False)
  
      create_dialog(dialog_type, text="dialog")
  
      response = element_send_keys(session, element, "foo")
      assert_error(response, "unexpected alert open")
  
      assert_dialog_handled(session, expected_text="dialog")
  