# How to handle alert box message in selenium test?

**URL:** <https://www.ruby-forum.com/t/how-to-handle-alert-box-message-in-selenium-test/76013>\
**Category:** Rails\
**Created:** [November 15, 2006, 6:45am UTC](https://www.ruby-forum.com/t/how-to-handle-alert-box-message-in-selenium-test/76013 "2006-11-15T06:45:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![narayana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f6c823/32.png) [@narayana](https://www.ruby-forum.com/u/narayana)\
**Post date:** [November 15, 2006, 6:45am UTC](https://www.ruby-forum.com/t/how-to-handle-alert-box-message-in-selenium-test/76013/1 "2006-11-15T06:45:42Z")

</div>

hi guys,

how to handle alert box message in selenium test?

i want to handle alert box. i want to test(verify text present) the  
text in alert box & then click ok to alert box. how can i do this.? plz  
tell me…

advance thx.

regards,  
karthick.

---

<div class="post-metadata">

**Author:** ![narayana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f6c823/32.png) [@narayana](https://www.ruby-forum.com/u/narayana)\
**Post date:** [November 15, 2006, 9:22am UTC](https://www.ruby-forum.com/t/how-to-handle-alert-box-message-in-selenium-test/76013/2 "2006-11-15T09:22:23Z")

</div>

Narayana K. wrote:

> hi guys,
> 
> how to handle alert box message in selenium test?
> 
> i want to handle alert box. i want to test(verify text present) the  
> text in alert box & then click ok to alert box. how can i do this.? plz  
> tell me…
> 
> advance thx.
> 
> regards,  
> karthick.

hi guys,

i found the answer for my problem.

by using the below code in your .rsel file, we can pass the test.  
assert\_alert\_present  
verify\_alert ‘alert message’

thx,  
regards,  
Karthick.
