Question

By using site-prism gem for integration testing, can I find page elements by referring to id or title or link or xpath or are they searchable only through css

Was it helpful?

Solution

UPDATE: It is possible, as of SitePrism 2.1 to use XPath expressions to find elements and sections, as well as CSS selectors.

====

You can only use CSS selectors, but using CSS you can still find elements by id, class, name, title, etc.

If you want to find an element by id:

#the_id

If you want to find an element by class:

.the_class

If you want to find an element by title:

div[title='the_title']

So, not exactly what you want, but you can get close.

Regarding XPath, see here: Does site_prism allow using other selectors than CSS?

Update

To find a link whose name property is 'bob':

a[name='bob']

To find a button whose id is 'fred':

button#fred

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top