How to use regural expression in dynamic changing ids in selenium in Ruby

715 views
Skip to first unread message

shalu

unread,
Jul 30, 2009, 5:45:57 AM7/30/09
to Indian Selenium Users Group
Hi all,

I am an new to selenium.I have few id's that are changing
dynamically.Can anyone please help me to use regural expression in the
place of dynmaic changing id

example

i have a an object id as "//tr[@id='item_row_1853']/td[5]" where the
item_row remains same but the 1853 changes dynamcially so i need to
replace with regural expressiion after item_row.

Regards,
Shalini

rajan perumal

unread,
Jul 31, 2009, 5:36:39 AM7/31/09
to indian-seleni...@googlegroups.com
Hi,
 
  Regular expression for identifying a dynamically changing object but this one uses
 
  selenium rc + ruby : //tr[contains(@id,''item_row")]
 
  This can match the object based upon partial verification of text.
 
Regards
Rajan

 

shalini kota

unread,
Aug 1, 2009, 1:54:33 PM8/1/09
to indian-seleni...@googlegroups.com
Thanks Rajan. it worked and the issue got resolved but if the dynamic
number is in between the object id, i am unable to use regural
expression

e.g. if the command is @selenium.type "cond_737437_name",
"Bulkupload_item" , in this if the number 737437 chnages dyamcially
how do i use regural expression in the dynamic changing number while
cond and name must be matched.

I tried as contains(@id, 'cond_*_name') it did not work for me.Can you
please let me know how to know..

Also it would be nice if you let me know the sites where the
selenium+ruby material is available.

Can Rdoc be used for the documenting the comments that are written
inside the methods...

Regards,
Shalini
--
Regards,
Shalini

rajan perumal

unread,
Aug 5, 2009, 1:40:12 AM8/5/09
to indian-seleni...@googlegroups.com
Hi shalini i did not see my mails for the past 3 days so thats why did not reply to your query.
 
Coming to your question i dont think that using * will work and Is the object that you are working on is an edit box. Also if you can explain me in detail what exactly that needs to be done or with other object id that can be used for identifying i can suggest you if possible with some solution.
 
Also you can see www.openqa.org for selenium+ruby materials.
 
Regards
Rajan

shalini kota

unread,
Aug 5, 2009, 1:57:00 AM8/5/09
to indian-seleni...@googlegroups.com
Hi Rajan,

Thanks for your reply.The object is an edit box that has a id as
/input[@id='cond_18092_name'] displayed in Xpather.The object is used
to add filter condition based on field.e.g if the filter codition is
name then the id will be cond_18092_name , if the field is average
rating the value of codition is /input[@id='cond_18092_avg_rating']. I
requirement is to use regural expression for the changing numberic
value in the id of edit box.

Another issue is, in my application i have an list of available
columns and list of selected columns displayed, user can drag and drop
from one avialable coumn to selected columns list.

When i code to drag_and_drop 3 columns for available columns to
selected columns list, only one field was ragged and dropped to
selected fields whereas other files could not be dragged and
dropped.Can you guess why this happens?

Regards,
Shalini
--
Regards,
Shalini

Bhupinder G

unread,
Nov 27, 2009, 4:02:20 AM11/27/09
to indian-seleni...@googlegroups.com
Use contains //tr[contains(@id,'item_row_')]/td[5]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Indian Selenium Users Group" group.
To post to this group, send email to indian-seleni...@googlegroups.com
To unsubscribe from this group, send email to indian-selenium-use...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/indian-selenium-users-group?hl=en
-~----------~----~----~----~------~----~------~--~---




--

Keep rocking dude :)
Bhupinder @ Pune
Reply all
Reply to author
Forward
0 new messages