html - Capybara selector for a span within a -


hello i've been struggling should simple select capybara. i'm after on page :

<a title="activity" class="" href="/changes">activity <span class="badge">1</span></a> 

i need assert there span.badge value 1 inside activity a tag.

before posted this, printed page contents , did save_and_open_page , content there.

this tried (which seemed promising cant find tag) :

find(:xpath, "//a[contains(.,'activity')]") find(:xpath, "//a[contains(@title, \"activity\")]") find(:xpath, "//a[@title='activity']") find(:xpath, "//a", :text => /reactivity /i) 

and many other things not worth mentioning, how this?

question update:

i forgot mention html hidden on page part of sub menu. adding capybara.ignore_hidden_elements = false works kind of sux add global config test, other ideas?

if understood correctly

//a[@title="activity" , span[@class="badge" , . = 1]] 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -