Skip to content

Commit

Permalink
HashNuke#212 add dialog_present?/0 function
Browse files Browse the repository at this point in the history
check for dialogs by reading from a dialog, if that fails assume the dialog is not present.
  • Loading branch information
Sebisnow committed Sep 11, 2019
1 parent 3be56f4 commit 1921e65
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/hound/helpers/dialog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ defmodule Hound.Helpers.Dialog do

import Hound.RequestUtils

@doc """
Checks if a dialog, javascript alert(), confirm() or prompt(), exists
dialog_present?()
"""
@spec dialog_present?() :: Boolean.t
def dialog_present? do
try do
dialog_text()
true
rescue
RuntimeError -> false
end
end

@doc """
Gets text of a javascript alert(), confirm() or prompt().
Expand Down

0 comments on commit 1921e65

Please sign in to comment.