Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created March 8, 2018 19:20
Show Gist options
  • Save twalpole/a541746b354afde8e82fa89a35a9b2da to your computer and use it in GitHub Desktop.
Save twalpole/a541746b354afde8e82fa89a35a9b2da to your computer and use it in GitHub Desktop.
require "capybara/dsl"
require "selenium-webdriver"
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app)
sess.visit("/")
sess.fill_in "dtl", with: "12131972\t0113p"
puts "value is #{sess.find_field("dtl").value}"
__END__
<!doctype html>
<html lang="en">
<head>
<title>React Id</title>
</head>
<body>
<input type="datetime-local" id="dtl"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment