Skip to content

Instantly share code, notes, and snippets.

@abotalov
Last active December 18, 2015 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abotalov/5752462 to your computer and use it in GitHub Desktop.
Save abotalov/5752462 to your computer and use it in GitHub Desktop.
require "capybara"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app)
sess.visit("/")
sess.find(:xpath,"//a[contains(text(),'Foo')]").click # Element looks like clicked after that
sleep 3
__END__
<!doctype html>
<div id="content">
<div id="left">
<div id="navigation">
<ul id="menu">
<li class="firstdrop">
<div>System</div>
<ul class="subdrop">
<li><a href="/foo.php" class="navlnk">Foo</a></li>
<li><a href="/bar.php" class="navlnk">Bar</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment