# Selenium and Rails

**URL:** <https://www.ruby-forum.com/t/selenium-and-rails/109240>\
**Category:** Rails\
**Created:** [July 12, 2007, 4:53pm UTC](https://www.ruby-forum.com/t/selenium-and-rails/109240 "2007-07-12T16:53:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hotgazpacho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a587f6/32.png) [@hotgazpacho](https://www.ruby-forum.com/u/hotgazpacho)\
**Post date:** [July 12, 2007, 4:53pm UTC](https://www.ruby-forum.com/t/selenium-and-rails/109240/1 "2007-07-12T16:53:33Z")

</div>

Hello all,  
Has anyone had any luck writing and using Selenium tests in the rails  
environment. If so, what pitfalls have you run into? Have you got any  
tips or tricks?

Thanks,  
Will

* * *

TV dinner still cooling?  
Check out “Tonight’s Picks” on Yahoo! TV.

---

<div class="post-metadata">

**Author:** ![hotgazpacho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a587f6/32.png) [@hotgazpacho](https://www.ruby-forum.com/u/hotgazpacho)\
**Post date:** [July 12, 2007, 5:01pm UTC](https://www.ruby-forum.com/t/selenium-and-rails/109240/2 "2007-07-12T17:01:34Z")

</div>

I have only used the IDE and then ported that to core for testing in  
IE.

I ran into issues with AJAX more than anything else. So, I have an  
AJAX call that dynamically updates a list. There is a trick to use  
waitforcondition where you can insert javascript. In this example, the  
country lists is seletected and then updates the holidays. Then the  
script will wait for the word “Boxing” to be populated before going  
on:

view code contains (which updates the holidays[] field through a  
partial render in the ical\_events action):  
\<%= observe\_field :holiday\_selected, :frequency=\>0.5,  
:update=\>‘ical\_list’,  
:url=\>  
{:controller=\>‘event’, :action=\>‘ical\_events’, :only\_path=\>false},  
:with=\>"‘holiday=’ + encodeURIComponent(value)" %\>

test code contains:

 select holiday\_selected label=Australian Holidays waitForCondition var value = selenium.getText("// select[@name='holidays[]']");&nbsp;&nbsp;value.match(/Boxing/) 5000
