Using Wildcards In Selenium IDE with VerifyelementPresent

2,147 views
Skip to first unread message

jratterree

unread,
Oct 31, 2008, 11:16:59 AM10/31/08
to selenium-users...@googlegroups.com
Hi everyone,
I'm testing a web page with selenium that has dynamically generated element names that may change when new builds are released.

We have items named:

+JoinPage_dyn_Template_CH_uxPage1Holder+

But everything up to the 'ux' is subject to change.

I would like to find element names using a wildcard search, like +*uxPage1Holder+ since that is the only part of the element I can be sure of.

I can do this

&nbsp;&nbsp;&nbsp; <td>clickAndWait</td>\\ &nbsp;&nbsp;&nbsp; <td>link=glob:Interested in joining?</td>\\ &nbsp;&nbsp;&nbsp; <td></td>

for testing a link, but I cant seem to make it work for VerifyElementPresent, which is where I'd mostly need it.

<tr>\\ &nbsp;&nbsp;&nbsp; <td>verifyElementPresent</td>\\ &nbsp;&nbsp;&nbsp; <td>JoinPage_dyn_Template_CH_uxInterestNote</td>\\ &nbsp;&nbsp;&nbsp; <td></td>\\ </tr>

What can I put in place of the name? I tried&nbsp;&nbsp;&nbsp; +Name=glob:*uxInterestNote+

and many variations of this, but it didnt seem to work out. Can anyone help me? Please?

Jesse R

Janesh

unread,
Nov 4, 2008, 6:09:35 AM11/4/08
to selenium-users...@googlegroups.com
Hi Jess
I will check if this can be done.
Did you have a look at the refernce? http://selenium-core.openqa.org/reference.html
Search for "Regular"

You may get a solution.

Regular expresions worked for VerifyTextPresent.

Cheers
Janesh

jratterree

unread,
Nov 5, 2008, 10:51:40 AM11/5/08
to selenium-users...@googlegroups.com
Thanks for the input, I am going to look into that, I think my only problem is I am unclear of how to actually put that into the IDE. what would it look like in HTML format?

Janesh

unread,
Nov 6, 2008, 6:16:03 AM11/6/08
to selenium-users...@googlegroups.com
1) Open Selenium IDE and Test Case
2) Click on the place where you want to eneter the command
3) Riight click and Select "Enter Command" from Menu
4) Eneter the command etc and Save the test


Hope this is useful.

jratterree

unread,
Nov 6, 2008, 9:48:23 AM11/6/08
to selenium-users...@googlegroups.com
Thanks, I know how to do that much, but the problem is how does the 'regular expression' stuff fit into the VerifyElementPresent statement.


<tr>\\ &nbsp;&nbsp;&nbsp; <td>verifyElementPresent</td>\\ &nbsp;&nbsp;&nbsp; <td>*JoinPage_dyn_Template_CH_uxInterestNote*</td>\\ &nbsp;&nbsp;&nbsp; <td></td>\\ </tr>

I'd assume i have to put something in the bold section here, but I am not clear on how.

jratterree

unread,
Nov 6, 2008, 2:53:25 PM11/6/08
to selenium-users...@googlegroups.com
I figured it out.

in the IDE its like this:


Command: +verifyElementPresent+
Target:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +xpath=//div[contains(@id, txt_Email)]+

In C#:

Assert.IsTrue(selenium.IsElementPresent("xpath=//div[contains(@name, MainNav)]"));

That will find the control with part of its name. I had ' ' around the search string, this is what was throwing me off.

Reply all
Reply to author
Forward
0 new messages