XPATH Syntax and Wildcard type stuff...

21 views
Skip to first unread message

mawa316

unread,
Aug 23, 2016, 6:19:55 PM8/23/16
to Selenium Users
Hi all,

I have an xpath that looks like this...

//*[@id="1471985985610-5-uiGrid-000U-cell"]/button[3]/span

What I want to do, since the ids are dynamic but they contain -<staticIndexNumber>- is find by xpath where id contains "-5-" and then the rest of the xpath

or

//*[@id contains "-5-"]/button[3]/span...

but I can't get the syntax for C# WebDriver quite right -- if its even possible to find an element in this way.

Any help appreciated!!

Aniket Mane

unread,
Aug 23, 2016, 9:39:53 PM8/23/16
to seleniu...@googlegroups.com

Mawa,
Try with this syntax:
//*[contains(@id,'-5-')]/button[3]/span...

Thanks,
Aniket


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5c40aa37-bb08-499c-9302-00f6dcee846d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mawa316 .

unread,
Aug 23, 2016, 10:20:35 PM8/23/16
to seleniu...@googlegroups.com
That works!  Thanks!!

On Tue, Aug 23, 2016 at 9:39 PM, Aniket Mane <aniket...@gmail.com> wrote:

Mawa,
Try with this syntax:
//*[contains(@id,'-5-')]/button[3]/span...

Thanks,
Aniket

On Aug 24, 2016 3:50 AM, "mawa316" <maw...@gmail.com> wrote:
Hi all,

I have an xpath that looks like this...

//*[@id="1471985985610-5-uiGrid-000U-cell"]/button[3]/span

What I want to do, since the ids are dynamic but they contain -<staticIndexNumber>- is find by xpath where id contains "-5-" and then the rest of the xpath

or

//*[@id contains "-5-"]/button[3]/span...

but I can't get the syntax for C# WebDriver quite right -- if its even possible to find an element in this way.

Any help appreciated!!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/zfmYhiTtLQg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to selenium-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages