Created
November 15, 2024 19:41
-
-
Save barrettkingram/a57ae7e1b74d5dc828c5720e6dcca5ea to your computer and use it in GitHub Desktop.
Use capybara to navigate and interact with a hosted website
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
# 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