This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'selenium-webdriver' | |
gem 'capybara' | |
end | |
require "capybara/dsl" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'capybara' | |
gem 'puma' | |
gem 'apparition' | |
gem 'selenium-webdriver' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'capybara' | |
gem 'puma' | |
gem 'apparition' | |
gem 'selenium-webdriver' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "selenium/webdriver" | |
require "capybara/dsl" | |
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("/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<select class="form-control" name="connection[driver]" id="connection_driver"><option value=""> Please select a driver</option> | |
<script src="https://code.jquery.com/jquery-3.1.0.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html = DATA.read | |
require "selenium-webdriver" | |
require "capybara/dsl" | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
sess = Capybara::Session.new(:selenium_chrome, app) | |
sess.visit('/') | |
tile = sess.find(:css, "deep-tile[test-id='property_data.smart_home_starter_kit.']") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html = DATA.read | |
require "selenium-webdriver" | |
require "capybara/dsl" | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
sess = Capybara::Session.new(:selenium_chrome, app) | |
sess.visit('/') | |
puts sess.find(:css, 'deep-tile[test-id="product.HO-3"]').text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html = DATA.read | |
require "capybara/dsl" | |
require "capybara/poltergeist" | |
require "openssl" | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
Capybara.register_driver :poltergeist do |app| | |
Capybara::Poltergeist::Driver.new(app, debug: true, js_errors: true, timeout: 60, logger: $stdout, | |
phantomjs_options: %w[--load-images=yes --ignore-ssl-errors=yes]) |