Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created November 12, 2018 17:42
Show Gist options
  • Save twalpole/4252d0b51ddec41543a09d3d53256d21 to your computer and use it in GitHub Desktop.
Save twalpole/4252d0b51ddec41543a09d3d53256d21 to your computer and use it in GitHub Desktop.
require "selenium/webdriver"
require "capybara/dsl"
require 'byebug'
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
# sess = Capybara::Session.new(:selenium, app) # use firefox
sess = Capybara::Session.new(:selenium_chrome, app) # use chrome
sess.visit('/')
sess.find('.comment-count', text: '1')
__END__
<!doctype html>
<html>
<head>
<title>Some title</title>
</head>
<body>
<ul attachments="section.attachments" class="collage ng-scope ng-isolate-scope" image-collage="" ng-if="isDisplaying">
<!-- ngRepeat: attachment in section.attachments -->
<li class="photo ng-scope" ng-repeat="attachment in section.attachments" style="width: 299px; height: 300px; margin-bottom: 9.6px; margin-right: 0px; display: inline-block; vertical-align: bottom; overflow: hidden; opacity: 1;">
<div class="meta-indicator">
<div class="comment-count">
<i class="fa fa-comment"></i>
<span ng-bind="attachment.commentsCount" class="ng-binding">1</span>
</div>
</div>
<a class="image-wrapper" href="">
<img ng-click="openModal(attachment)" ng-src="https://d545dpp7432ym.cloudfront.net/images/medium/test-image.jpg" role="button" tabindex="0" src="https://d545dpp7432ym.cloudfront.net/images/medium/test-image.jpg" style="width: 299px; height: 300px;">
</a>
</li>
<!-- end ngRepeat: attachment in section.attachments -->
</ul> </body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment