ruby on rails - In Capybara, how can I select a dynamically generated element -


i want select following element:

<tr class="tr_even" id="13-hey-guys"> 

i want select id dynamically generated concatenation of object's id , name.

when use line capture it:

within('tr id=\"#{item.id}-#{item.name.downcase}\"')     ... 

i following error:

failure/error: within('tr id=\"#{item.id}-#{item.name.downcase}\"')  nokogiri::css::syntaxerror:    unexpected '=' after '[#<nokogiri::css::node:0x0000010835f210 @type=:descendant_selector, @value=[#<nokogiri::css::node:0x0000010835f4e0 @type=:element_name, @value=["tr"]>, #<nokogiri::css::node:0x0000010835f2b0 @type=:element_name, @value=["id"]>]>]' 

how capture element

by default, capybara uses css find elements.

i believe right way find element should be:

within("tr##{item.id}-#{item.name.downcase}")   ... 

i hope helps.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -