contains() method of xpath not responding if uses _ underscore

300 views
Skip to first unread message

Chetan

unread,
Aug 7, 2009, 12:08:31 AM8/7/09
to selenium-users...@googlegroups.com
I have id something like "blah_blah:blah_blah:w_HP_Widget_0_1"

I tried following xpath to identify this elementbut selenium could not recognized
//*[contains(@id,w_HP_Widget)]

BUT when I used following xpath element identified
//*[contains(@id,Widget)]

My conclusion is that contains() method of xPath not support _ underscore in selenium.

Let me know anybody if this is known bug.
If anybody have some workaround please let me know

Thanks

Mark Collin

unread,
Aug 8, 2009, 7:50:48 AM8/8/09
to selenium-users...@googlegroups.com
Try:

//*[contains(@id, 'w_HP_Widget')]

Chetan

unread,
Aug 8, 2009, 9:01:06 AM8/8/09
to selenium-users...@googlegroups.com
Thanks, I tried this also, but no luck,

But I found workaround as follows:

String str = "_w_HP_";
//*[contains(@id,'"+str+"')]

:) its working fine

Chetan

unread,
Aug 15, 2009, 7:53:40 AM8/15/09
to selenium-users...@googlegroups.com
Again it is failing, I think there is some serous issue with _ underscore.
I am using Selenium since a year, please let me know if anybody has some solution/work around.

Reply all
Reply to author
Forward
0 new messages