Question

How does capybara access/finds/matches html elements? I come from a watir background so for me capybara is a bit high level and I can't quite really get the grasp of it even with the tutorials. let's say for example we have element

<input id="submit-button" type="submit" value="Post Your Question" tabindex="120">

so how do I make capybara click that button? On watir-webdriver I could easily do a browser.button(:id => "submit-button").click what's the capybara equivalent?

Was it helpful?

Solution

click_button("Post Your Question") should work for you. Check out the Capybara Cheat Sheet.

EDIT: To expand on this when you want to click a button you will use the click_button method and pass the value as a parameter to this method.

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