Writing Xpaths

124 views
Skip to first unread message

techi...@gmail.com

unread,
Nov 17, 2015, 4:10:15 PM11/17/15
to Selenium Users
Team,

Is there any good online references to learn on writing xpaths? like writing generic paths instead of hard coding using ids



Ex: below is generic xpath searching for text with different patterns

/*[contains(text(),'ABC:')]/following::input[@type='text'][1] | //*[contains(text(),'ABC:')]/descendant::input[@type='text'][1] | //*[contains(text(),'ABC?')]/following::input[@type='text'][1] | //*[contains(text(),'ABC?')]/descendant::input[@type='text'][1] | //*[normalize-space(text())='ABC']/following::input[@type='text'][1] | //*[normalize-space(text())='ABC']/descendant::input[@type='text'][1] | //form/descendant::input[@type='text' and not( //*[contains(text(),'ABC:')]/following::input[@type='text'][1] | //*[contains(text(),'ABC:')]/descendant::input[@type='text'][1] |


thanks,

Moises Siles

unread,
Nov 17, 2015, 7:19:40 PM11/17/15
to seleniu...@googlegroups.com
Please take a look on these links related to css, you should consider to use css instead of xpath



Regards

--
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-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/6c18c4f6-568b-49e8-bd4e-a758e9ed6234%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MWQA

unread,
Nov 18, 2015, 8:26:33 AM11/18/15
to Selenium Users

Mukesh otwani

unread,
Nov 21, 2015, 4:54:02 AM11/21/15
to Selenium Users

SantoshSarma

unread,
Nov 23, 2015, 5:54:58 AM11/23/15
to Selenium Users

gorants 456

unread,
Nov 23, 2015, 10:29:33 AM11/23/15
to seleniu...@googlegroups.com
Thank you all for your valuable inputs.

--
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/ciV3wih_v1w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

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