Skip to content

Instantly share code, notes, and snippets.

@barrettkingram
Created November 15, 2024 19:41
Show Gist options
  • Save barrettkingram/a57ae7e1b74d5dc828c5720e6dcca5ea to your computer and use it in GitHub Desktop.
Save barrettkingram/a57ae7e1b74d5dc828c5720e6dcca5ea to your computer and use it in GitHub Desktop.
Use capybara to navigate and interact with a hosted website
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
gem 'capybara'
gem 'selenium-webdriver'
end
require 'csv'
require 'json'
require 'capybara'
require 'capybara/dsl'
Capybara.default_driver = :selenium
class Bot
include Capybara::DSL
def fill_out_form
visit('https://www.example.com')
fill_in('Search', with: "My Search Term")
end
end
Bot.new.fill_out_form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment