capybara click_link with :href match July 29, 2023 by Tarik you can use find find(:xpath, "//a[@href="https://stackoverflow.com/foo"]").click