Srikanth
Srikanth

Reputation: 265

How to get CSS Style of section in Siteprism Page object model using Cucumber/Capybara

How to get CSS Style of section in Siteprism Page object model using Cucumber/Capybara. For an element, I use the below code to get CSS

@app.page_name.element_name.css('height')

For sections, When I try to use same as above like

@app.page_name.section_name.css('height')

I am getting error as

undefined method `css' for #section_name_Section:0x3635b08> (NoMethodError)

Is there anyway to get css of section directly instead of creating one more element for the same section and using it?

or

Is there any way to convert section into element in step definitions?

Upvotes: 1

Views: 1120

Answers (2)

Luke Hill
Luke Hill

Reputation: 458

If you want to get the root full css selector (Class only), use ['class'] as an attribute which will then be returned.

So @app.page_name.selector['class']

Upvotes: 0

Nat Ritmeyer
Nat Ritmeyer

Reputation: 5678

Instead of:

@app.page_name.section_name.css('height')

...try:

@app.page_name.section_name.root_element.css('height')

Upvotes: 1

Related Questions