Reputation: 4415
Is there a way to get the css selector for a page object you defined in SitePrism? For instance if I have
class myPageObject < SitePrism::Page
...
element :my_element, '.my-element-class'
...
end
How could I use the selector in a test to get .my-element-class
?
Upvotes: 0
Views: 684
Reputation: 458
Old post but adding for info
A specific element on a page will only have 1 xpath (Or possible a subset of these), but it is very definitely finite. This is because of the way xpath is inherently structured. It represents the DOM.
CSS Selectors can be defined in a multitude of ways, and as such it can be considered than a single element could have infinite css selectors.
If you want to find out the specific class property of an element, that is possible by doing my_page.my_element['class']
- However this will return a space delimited string of just the class properties of the current element.
Upvotes: 0
Reputation: 49910
No - SitePrism doesn't store the parameters passed to element
in any accessible way
Upvotes: 1