# Passing variables in to page objects

**URL:** <https://www.ruby-forum.com/t/passing-variables-in-to-page-objects/180040>\
**Category:** Rails\
**Created:** [December 10, 2009, 4:50am UTC](https://www.ruby-forum.com/t/passing-variables-in-to-page-objects/180040 "2009-12-10T04:50:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike343](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike343](https://www.ruby-forum.com/u/mike343)\
**Post date:** [December 10, 2009, 4:50am UTC](https://www.ruby-forum.com/t/passing-variables-in-to-page-objects/180040/1 "2009-12-10T04:50:45Z")

</div>

I am very new to Ruby and Rails and have the following question.

Can you pass a ruby variable into a page object?

I am using some Ajax and am using the following code in my .rjs file

page[:status].visual\_effect :highlight

This works when I have one instance of “id=“status”” as an id in my  
html, but I have several that correspond to “id=“status\_\<%= status.id  
%\>”” and I thus need to make the method I am passing into my page[]  
object be a variable.

(I hope I didn’t get any terms wrong, if so, I apologize)

---

<div class="post-metadata">

**Author:** ![mike343](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike343](https://www.ruby-forum.com/u/mike343)\
**Post date:** [December 10, 2009, 5:37am UTC](https://www.ruby-forum.com/t/passing-variables-in-to-page-objects/180040/2 "2009-12-10T05:37:29Z")

</div>

Hi Michael M.

```
Dont know your code But you can do as some think similar to the 

```

below code(In rjs)

status = “status#{status.id}”  
page[:status].visual\_effect :highlight

Sijo

---

<div class="post-metadata">

**Author:** ![mike343](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike343](https://www.ruby-forum.com/u/mike343)\
**Post date:** [December 10, 2009, 4:49pm UTC](https://www.ruby-forum.com/t/passing-variables-in-to-page-objects/180040/3 "2009-12-10T16:49:03Z")

</div>

Thank you. It worked with the following mod:

status = “status#{status.id}”  
page[status].visual\_effect :highlight

I took the colon out of the “status” in the page object. Thanks again!

Sijo k g wrote:

> Hi Michael M.
> 
> ```
> Dont know your code But you can do as some think similar to the 
> 
> ```
> 
> below code(In rjs)
> 
> status = “status#{status.id}”  
> page[:status].visual\_effect :highlight
> 
> Sijo
