Skip to content

Commit

Permalink
Update README (#2721)
Browse files Browse the repository at this point in the history
* Update README

- Do not mention about dismissing an alert. You cannot really dismiss it since there is only one button named "OK".
- Add more examples on how to dismiss `confirm` and `prompt` dialogs.
- Enhance other examples with optional `text` arguments.
  • Loading branch information
artur-intech committed Jan 26, 2024
1 parent 1857cb1 commit a900ac7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,26 +618,38 @@ JS

In drivers which support it, you can accept, dismiss and respond to alerts, confirms, and prompts.

You can accept or dismiss alert messages by wrapping the code that produces an alert in a block:
You can accept alert messages by wrapping the code that produces an alert in a block:

```ruby
accept_alert do
accept_alert 'optional text or regex' do
click_link('Show Alert')
end
```

You can accept or dismiss a confirmation by wrapping it in a block, as well:

```ruby
dismiss_confirm do
accept_confirm 'optional text' do
click_link('Show Confirm')
end
```

```ruby
dismiss_confirm 'optional text' do
click_link('Show Confirm')
end
```

You can accept or dismiss prompts as well, and also provide text to fill in for the response:

```ruby
accept_prompt(with: 'Linus Torvalds') do
accept_prompt('optional text', with: 'Linus Torvalds') do
click_link('Show Prompt About Linux')
end
```

```ruby
dismiss_prompt('optional text') do
click_link('Show Prompt About Linux')
end
```
Expand Down

0 comments on commit a900ac7

Please sign in to comment.